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

Function mfa_delete

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

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)

Source from the content-addressed store, hash-verified

332
333
334def 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
359def mfa_add(auth_name: str, options: str) -> None:

Callers 1

_mfa_registration_viewFunction · 0.85

Calls 1

deleteMethod · 0.45

Tested by

no test coverage detected