Skip to content

Commit

Permalink
fixup! fixup! [FIX] some permission problems; call super in order to …
Browse files Browse the repository at this point in the history
…have regular password reset flow intact
  • Loading branch information
thomaspaulb committed Dec 3, 2024
1 parent 0bbd210 commit 65fb9d8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions auth_sms_auth_signup/controllers/auth_sms_auth_signup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,7 @@ def web_auth_reset_password(self, *args, **kw):
)
)
user = partner.user_ids[:1]
if request.httprequest.method == "POST" and kw.get("auth_sms_request_code"):
try:
request.env["res.users"].sudo()._auth_sms_send(user.id)
qcontext["auth_sms_code_requested"] = True
except Exception as e:
qcontext["error"] = str(e)
_logger.error(traceback.format_exc())
return request.render('auth_signup.reset_password', qcontext)

elif request.httprequest.method == "POST" and kw.get("auth_sms_code"):
if request.httprequest.method == "POST" and kw.get("auth_sms_code"):
request.session["auth_sms.code"] = kw["auth_sms_code"]
try:
user.sudo(user)._auth_sms_check_credentials()
Expand All @@ -45,5 +36,13 @@ def web_auth_reset_password(self, *args, **kw):
if request.session.get("auth_sms.code"):
return super().web_auth_reset_password(*args, **kw)
return request.render('auth_signup.reset_password', qcontext)
elif request.httprequest.method == "POST" and kw.get("auth_sms_request_code"):
try:
request.env["res.users"].sudo()._auth_sms_send(user.id)
qcontext["auth_sms_code_requested"] = True
except Exception as e:
qcontext["error"] = str(e)
_logger.error(traceback.format_exc())
return request.render('auth_signup.reset_password', qcontext)

return super().web_auth_reset_password(*args, **kw)

0 comments on commit 65fb9d8

Please sign in to comment.