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)
| 386 | |
| 387 | |
| 388 | def 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 |
no test coverage detected