Skip to content

allow current user to reset their own password #5034

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

Closed

Conversation

coolaj86
Copy link
Contributor

@coolaj86 coolaj86 commented Oct 7, 2018

Re: #5008

The current logged-in user (which may have signed in via OAuth) is not able to reset their own password via email reset, because they cannot access the form.

  • Users can get to reset form logged in and logged out
  • Can attempt to reset password without being logged out
  • If password reset will be successful, user is logged out (and is redirected to login)

Beyond fixing the bug, these are some things I'd be open to adding now (but would prefer to wait until after this clears)

  • show username / email of user
    • take some action if that's different from the current user?
  • treat reset password form the same as register & sign in (remember me, retype password)
  • invalidate the code once used
  • set time to 15 minutes rather than 3 hours

@codecov-io
Copy link

codecov-io commented Oct 7, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@c168095). Click here to learn what that means.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5034   +/-   ##
=========================================
  Coverage          ?   40.47%           
=========================================
  Files             ?      405           
  Lines             ?    54399           
  Branches          ?        0           
=========================================
  Hits              ?    22017           
  Misses            ?    29356           
  Partials          ?     3026
Impacted Files Coverage Δ
routers/routes/routes.go 82.02% <100%> (ø)
routers/user/auth.go 13.15% <30%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c168095...0d701e4. Read the comment docs.

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 7, 2018
@@ -1179,6 +1185,10 @@ func ResetPasswdPost(ctx *context.Context) {
ctx.ServerError("UpdateUser", err)
return
}

// Just in case the user is signed in to another account
handleSignOut(ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that there would be check for code that was issued for what user and currently authorised user and if they do not much than return error (probably 404?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be another PR.

@lafriks lafriks added this to the 1.7.0 milestone Oct 7, 2018
@coolaj86
Copy link
Contributor Author

coolaj86 commented Oct 7, 2018

The 404 that's already there is really confusing. I think there should be some sort of error message to the user like "This code is not valid or has expired." to let them know that Gitea doesn't have a bug, it recognized what they were trying to do, but followed a set of rules to disallow the action they intended, and gives them a clue as to what to do next to accomplish their goal.

Although the type of user we have is probably pretty savvy, giving feedback so will also increase security by reducing chances for social engineering attacks or pranks.

@coolaj86
Copy link
Contributor Author

coolaj86 commented Oct 7, 2018

I've got a second PR on the way that contains the ux fixes, showing the correct error message in each of the edge cases discussed in this issue as well as the original issue.

It's currently visible in use at https://git.coolaj86.com, but I have to fix a conflict between my v1.5.1 backports and master, and I have to head out for a bit, so I may not push it until tonight.

@lafriks
Copy link
Member

lafriks commented Nov 8, 2018

Can these changes be merged into #5042 ?

@coolaj86
Copy link
Contributor Author

coolaj86 commented Nov 9, 2018

@lafriks I'm still a bit under water right now, but I'll try to make some time to merge them together. Thanks for reviewing. :)

@lafriks lafriks modified the milestones: 1.7.0, 1.8.0 Dec 27, 2018
@techknowlogick techknowlogick modified the milestones: 1.8.0, 1.9.0 Feb 19, 2019
@ryanburnette ryanburnette force-pushed the current-user-password-reset branch from d3a4d76 to 0d701e4 Compare April 13, 2019 21:50
@coolaj86
Copy link
Contributor Author

Rebased and ready for re-review!

@stale
Copy link

stale bot commented Jun 12, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Jun 12, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jun 26, 2019
@stale stale bot removed the issue/stale label Jun 26, 2019
@lunny
Copy link
Member

lunny commented Jun 26, 2019

Please resolve the conflicts

@zeripath
Copy link
Contributor

It looks like #5042 supersedes this.

What's the envisioned behaviour for this.

@lunny
Copy link
Member

lunny commented Jun 29, 2019

@solderjs please confirm that this could be closed since #5042 merged.

@coolaj86
Copy link
Contributor Author

Looking at the commit history, I believe that is correct. These changes were included in and improved upon by #5042

1 similar comment
@coolaj86
Copy link
Contributor Author

Looking at the commit history, I believe that is correct. These changes were included in and improved upon by #5042

@coolaj86 coolaj86 closed this Jun 30, 2019
@zeripath
Copy link
Contributor

Thanks @solderjs for your contributions. Sorry some of them have languished.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants