-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
[15.0][FIX] password_security: Reset Password issue #492
Conversation
a97b93b
to
b320d4d
Compare
qcontext["error"] = e.args[0] | ||
response = request.render("auth_signup.reset_password", qcontext) | ||
response.headers["X-Frame-Options"] = "DENY" | ||
return response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the call to _validate_pass_reset moved into res.users
action_reset_password instead? That would remove the need for this copy pasta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be necessary to check to see if the request.uid
is the admin user, to allow for bulk password resets that ignore this setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit 8a5ead9 I moved _validate_pass_reset
into action_reset_password
. It seems working fine to me. Would you also give it a look?
b0b5320
to
8a5ead9
Compare
if self.env.context.get("install_mode"): | ||
return | ||
if not self.env.context.get("create_user"): | ||
users = self.filtered(lambda user: user.active) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This active user check seems redundant with
but maybe it is handling a case where a module could create an inactive user?
Good catch on the install_mode check. Maybe also add something like
if self.env.uid == SUPERUSER_ID:
as I just got Passwords can only be reset every 24 hour(s). Please contact an administrator for assistance.
while logged in as admin. 😆
Edit: Steps to reproduce as admin on a brand new instance with --init=password_security
:
- Home Menu > Settings
- Users & Companies > Users
- Check Administrator
- Action > Send Password Reset Instructions
- Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check on active is redundant but I made it on purpose, so that in case an user is inactive, this standard error will be always raised, instead of the eventual _validate_pass_reset
.
I just added the SUPERUSER_ID check.
783bd4d
to
9e194e9
Compare
05a45f4
to
d3c90a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if there's anything to be done about the codecov/project
red build. Yes, the lines of code covered have decreased, but that's because the new code is fewer lines of code...
d3c90a9
to
7d2a93a
Compare
5711947
to
b339d39
Compare
b339d39
to
a71e6f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @OCA/tools-maintainers
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at dda6ac1. Thanks a lot for contributing to OCA. ❤️ |
Syncing from upstream OCA/server-auth (16.0)
Fixes the Reset Password issue described in #54.
The fix is backported from #482.
Replaces mocked tests for password reset, as they were not capable to test the code properly.