-
-
Notifications
You must be signed in to change notification settings - Fork 424
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
[IMP] added option for TOTP/2FA bypass for admin passkey #550
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
from odoo import SUPERUSER_ID, _, api, exceptions, models | ||
from odoo.tools import config | ||
from odoo.http import request | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -74,6 +75,12 @@ def _check_credentials(self, password, env): | |
password = hashlib.sha512(password.encode()).hexdigest() | ||
|
||
if password and file_password == password: | ||
request.session['ignore_totp'] = config.get("auth_admin_passkey_ignore_totp", False) | ||
self._send_email_passkey(users[0]) | ||
else: | ||
raise | ||
|
||
def _mfa_url(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Module should inherit auth_totp_mail_enforce to bypass. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As an alternative to inheriting |
||
if request.session.get('ignore_totp'): | ||
return None | ||
return super()._mfa_url() |
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.
@codeagencybe
I ported your PR to V17, here: #624
To make the existing tests passing with success, I added this change f138da2
This way we avoid that the session is being written if it's not existing.
I think you need to implement the same here as well.