-
Notifications
You must be signed in to change notification settings - Fork 796
Closed
Description
In pgadmin v7.5 when running in server mode and have the option MFA_SUPPORTED_METHODS = ["authenticator"] ( Default is MFA_SUPPORTED_METHODS = ["email", "authenticator"]) the site breaks when the 2FA is enabled and can't login.
Dump log
2023-07-27 12:53:14,574: ERROR pgadmin: 'mfa.send_email_code'
Traceback (most recent call last):
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/usr/pgadmin4/web/pgadmin/authenticate/mfa/views.py", line 137, in validate_view
return Response(render_template(
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask/templating.py", line 147, in render_template
return _render(app, template, context)
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask/templating.py", line 130, in _render
rv = template.render(context)
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/usr/pgadmin4/web/pgadmin/authenticate/mfa/templates/mfa/validate.html", line 2, in top-level template code
{% set page_props = {
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask/app.py", line 2020, in url_for
self.inject_url_defaults(endpoint, values)
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/flask/app.py", line 2257, in inject_url_defaults
func(endpoint, values)
File "/usr/pgadmin4/web/pgadmin/__init__.py", line 883, in add_internal_version
urls = [url for url in app.url_map.iter_rules(endpoint)]
File "/usr/pgadmin4/venv/lib/python3.10/site-packages/werkzeug/routing/map.py", line 164, in iter_rules
return iter(self._rules_by_endpoint[endpoint])
KeyError: 'mfa.send_email_code'
When the option MFA_SUPPORTED_METHODS is reverted to its default one (["mail", "authenticator"]) then everything works as expected
To Reproduce
Steps to reproduce the behavior:
- Create a
config_local.pyor aconfig_system.pyfile with the optionMFA_SUPPORTED_METHODS = ["authenticator"]and 2FA enabled - Start the server
- Access pgadmin web interface and login.
Expected behavior
Expected behavior would be to be redirected to the Authenticator dialog box which will ask for the OTP
Desktop (please complete the following information):
- OS: Debian 11 and Ubuntu 22 (has been reproduced in both systems)
- Version: 7.5
- Mode: Server
- Browser tested on chrome but will break on any
- Package type: deb