Giter VIP home page Giter VIP logo

Comments (14)

GDay avatar GDay commented on June 12, 2024 1

Awesome, good to hear! No worries - happy to help. I will update the docs to make it a bit clearer.

from chiefonboarding.

thealpha93 avatar thealpha93 commented on June 12, 2024 1

I had to user email instead of username to reset password

def reset_password(mail, password):
    try:
        user = get_user_model().objects.get(email=mail)
    except:
        return "User could not be found"
    user.set_password(password)
    user.save()
    return "Password has been changed successfully"

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

Generally, a 400 error means that Django doesn't recognize the ALLOWED_HOSTS. Can you check if the ALLOWED_HOST variable is set to your URL in the Django environment variables? That's in back/back/.env.

from chiefonboarding.

amolvishwakarma avatar amolvishwakarma commented on June 12, 2024

Generally, a 400 error means that Django doesn't recognize the ALLOWED_HOSTS. Can you check if the ALLOWED_HOST variable is set to your URL in the Django environment variables? That's in back/back/.env.

Allowed host value is '*' in back/back/.env @GDay

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

Oh wait, I think I misread your first message. Sorry. The login part loads, but you just cannot login, is that correct?

A 400 error in that case means that your username and password are not correct. Please note that the username (which needs to be an email address) and password are both case-sensitive. Also make sure that you didn't add a space after your username.

from chiefonboarding.

amolvishwakarma avatar amolvishwakarma commented on June 12, 2024

Oh wait, I think I misread your first message. Sorry. The login part loads, but you just cannot login, is that correct?

A 400 error in that case means that your username and password are not correct. Please note that the username (which needs to be an email address) and password are both case-sensitive. Also make sure that you didn't add a space after your username.

Email address and password both are correct created another user with same password and same error for that too @GDay

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

Very strange. Were you able to log in previously or have you never been able to log in? When you make the login request, what does it respond with? When I type in a wrong username and password, it responds with this:

Schermafbeelding 2021-03-04 om 14 24 36

from chiefonboarding.

amolvishwakarma avatar amolvishwakarma commented on June 12, 2024

Very strange. Were you able to log in previously or have you never been able to log in? When you make the login request, what does it respond with? When I type in a wrong username and password, it responds with this:

Schermafbeelding 2021-03-04 om 14 24 36

Not been able to login @GDay
My application is externally running on non standard SSL port 6443

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

When you make the login request, what does it respond with? Rightmouseclick on the screen -> inspect element -> open the network tab -> make the login request and then click on 'response'. Does it give the same error that I showed in the screenshot?

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

Okay, so yeah, your username and password are probably not correct. Let's try this, just to be sure:

When you have SSH access, do this:

docker-compose run web python3 manage.py shell

Then do this:

from django.contrib.auth import get_user_model
list(get_user_model().objects.all().values_list('email', flat=True))

That should give you a list with users that are in the system right now. Then do this:

def reset_password(u, password):
    try:
        user = get_user_model().objects.get(username=u)
    except:
        return "User could not be found"
    user.set_password(password)
    user.save()
    return "Password has been changed successfully"

That adds a function that we can use to change the password.

Up next, we will change the password. Do the following, but change username with any of the values that are shown in the list and then password with something super easy. Avoid using special characters in this case. We just want to get logging in working right now. You should change it once you are logged in to something that is more complicated.

reset_password(username, password)

By the way, you might want to remove the screenshot as it shows your domain name.

from chiefonboarding.

amolvishwakarma avatar amolvishwakarma commented on June 12, 2024

This function code doesn't allowing me to change password @GDay

from chiefonboarding.

GDay avatar GDay commented on June 12, 2024

I think I see where it went wrong. So.. when creating a user, it says on the page to do

User.objects.create_admin("<first name>", "<last name>", "<email>", "<password>")

You probably included the < >. That's not correct. Here is an actual example of adding a new user:

User.objects.create_admin("Stan", "Doe", "[email protected]", "Somethingsupersecret")

So please remove your users:

get_user_model().objects.all().delete()

and add a new user again but then don't use < and >.

Makes sense?

from chiefonboarding.

amolvishwakarma avatar amolvishwakarma commented on June 12, 2024

I think I see where it went wrong. So.. when creating a user, it says on the page to do

User.objects.create_admin("<first name>", "<last name>", "<email>", "<password>")

You probably included the < >. That's not correct. Here is an actual example of adding a new user:

User.objects.create_admin("Stan", "Doe", "[email protected]", "Somethingsupersecret")

So please remove your users:

get_user_model().objects.all().delete()

and add a new user again but then don't use < and >.

Makes sense?

Yes , I had used < > while creating user , I will remove users and create one and let you know if the issue will resolve @GDay

from chiefonboarding.

amolvishwakarma avatar amolvishwakarma commented on June 12, 2024

Yes, it worked
Thanks for your help and support it worked like a charm and sorry for the trouble you can close the issue @GDay

from chiefonboarding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.