Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change existing user's password ? #7

Closed
Georges760 opened this issue Apr 2, 2016 · 3 comments
Closed

How to change existing user's password ? #7

Georges760 opened this issue Apr 2, 2016 · 3 comments

Comments

@Georges760
Copy link

There is no function in UserState permitting to hange a user password (update the password hash).

Would it be possible to have one ?

@xyproto
Copy link
Owner

xyproto commented Apr 3, 2016

Hi,

I agree that such a function would be nice to have. I will consider implementing one.

In the mean time, the following works, for changing the password:

// Change the password for user "bob" to "hunter2"
username := "bob"
password := "hunter2"
passwordHash := userstate.HashPassword(username, password)
userstate.Users().Set(username, "password", passwordHash)

Best regards,
Alexander F Rødseth

@Georges760
Copy link
Author

Great,
this method works great, so I can use it for now. When I will be done, I will find some time to do the "func (state *UserState) ChangePassword(username, password string) error" function for you.

@xyproto
Copy link
Owner

xyproto commented Apr 4, 2016

Added SetPassword.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants