MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / fetch_auth_option

Function fetch_auth_option

web/pgadmin/authenticate/mfa/utils.py:388–408  ·  view source on GitHub ↗

A utility function to fetch the extra data, stored as options, for the given auth method for the current user. Returns a set as (data, Auth method registered?) Args: auth_name (str): Name of the auth method Returns: (str, bool): (data, has current user registe

(auth_name: str)

Source from the content-addressed store, hash-verified

386
387
388def fetch_auth_option(auth_name: str) -> (str, bool):
389 """
390 A utility function to fetch the extra data, stored as options, for the
391 given auth method for the current user.
392
393 Returns a set as (data, Auth method registered?)
394
395 Args:
396 auth_name (str): Name of the auth method
397
398 Returns:
399 (str, bool): (data, has current user registered for the auth method?)
400 """
401 auth = UserMFA.query.filter_by(
402 user_id=current_user.id, mfa_auth=auth_name
403 ).first()
404
405 if auth is None:
406 return None, False
407
408 return auth.options, True

Callers 2

send_email_codeFunction · 0.85

Calls 1

firstMethod · 0.65

Tested by

no test coverage detected