Skip to content

Commit

Permalink
fixup! [FIX] some permission problems; call super in order to have re…
Browse files Browse the repository at this point in the history
…gular password reset flow intact
  • Loading branch information
thomaspaulb committed Dec 3, 2024
1 parent cdfcc8f commit bdb223e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions auth_sms_auth_signup/controllers/auth_sms_auth_signup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Copyright 2019 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import logging
import traceback

from odoo import http
from odoo.http import request

from odoo.addons.auth_signup.controllers.main import AuthSignupHome

_logger = logging.getLogger(__name__)


class AuthSmsAuthSignup(AuthSignupHome):
@http.route()
Expand All @@ -25,14 +30,16 @@ def web_auth_reset_password(self, *args, **kw):
request.env["res.users"].sudo()._auth_sms_send(user.id)
qcontext["auth_sms_code_requested"] = True
except Exception as e:
qcontext["error"] = e.message or e
qcontext["error"] = str(e)
_logger.error(traceback.format_exc())
elif 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()
except Exception as e:
del request.session["auth_sms.code"]
qcontext["error"] = e.message if hasattr(e, "message") else str(e)
qcontext["error"] = str(e)
_logger.error(traceback.format_exc())
if request.session.get("auth_sms.code"):
return super(AuthSmsAuthSignup, self).web_auth_reset_password(
*args, **kw
Expand Down

0 comments on commit bdb223e

Please sign in to comment.