New module for supporting two-factor authentication via time-base one-time-password (TOTP). Users (including portal users) can choose to enable two-factor auth in their user account settings, by scanning a QR code and adding it to an authenticator app, such as Google Auth, 1Password, etc. When two-factor is enabled, password-based non-interactive RPC is only possible by using API keys. Co-authored-by: Olivier Dony <odo@odoo.com>
14 lines
373 B
Python
14 lines
373 B
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models
|
|
from odoo.http import request
|
|
|
|
class IrHttp(models.AbstractModel):
|
|
_inherit = 'ir.http'
|
|
|
|
def session_info(self):
|
|
info = super().session_info()
|
|
# because frontend session_info uses this key and is embedded in
|
|
# the view source
|
|
info["user_id"] = request.session.uid,
|
|
return info
|