[IMP] auth_admin, [ADD] auth_admin_website: enable select website to get base url from company

H4905
This commit is contained in:
Cedric Collins
2021-02-18 17:09:34 -06:00
parent 49ecf8e4fa
commit 4a637d277c
7 changed files with 58 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ from logging import getLogger
_logger = getLogger(__name__)
def admin_auth_generate_login(env, user):
def admin_auth_generate_login(env, user, base_url=None):
"""
Generates a URL to allow the current user to login as the portal user.
@@ -29,7 +29,7 @@ def admin_auth_generate_login(env, user):
key = str(config.search([('key', '=', 'database.secret')], limit=1).value)
h = hmac.new(key.encode(), (u + e + o).encode(), sha256)
base_url = str(config.search([('key', '=', 'web.base.url')], limit=1).value)
base_url = base_url or str(config.search([('key', '=', 'web.base.url')], limit=1).value)
_logger.warn('login url for user id: ' + u + ' original user id: ' + o)