A utility function to delete the auth method for the current user from the configuration database. Args: auth_name (str): Name of the argument Returns: bool: True if auth method was registered for the current user, and delete successfully, otherwise -
(auth_name: str)
| 332 | |
| 333 | |
| 334 | def mfa_delete(auth_name: str) -> bool: |
| 335 | """ |
| 336 | A utility function to delete the auth method for the current user from the |
| 337 | configuration database. |
| 338 | |
| 339 | Args: |
| 340 | auth_name (str): Name of the argument |
| 341 | |
| 342 | Returns: |
| 343 | bool: True if auth method was registered for the current user, and |
| 344 | delete successfully, otherwise - False |
| 345 | """ |
| 346 | auth = UserMFA.query.filter_by( |
| 347 | user_id=current_user.id, mfa_auth=auth_name |
| 348 | ) |
| 349 | |
| 350 | if int(auth.count()) != 0: |
| 351 | auth.delete() |
| 352 | db.session.commit() |
| 353 | |
| 354 | return True |
| 355 | |
| 356 | return False |
| 357 | |
| 358 | |
| 359 | def mfa_add(auth_name: str, options: str) -> None: |
no test coverage detected