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

Function validate_master_password

web/pgadmin/utils/master_password.py:71–89  ·  view source on GitHub ↗

Validate the password/key against the stored encrypted text :param password: password/key :return: Valid or not

(password)

Source from the content-addressed store, hash-verified

69
70
71def validate_master_password(password):
72 """
73 Validate the password/key against the stored encrypted text
74 :param password: password/key
75 :return: Valid or not
76 """
77 # master pass is incorrect if decryption fails
78 try:
79 decrypted_text = decrypt(current_user.masterpass_check, password)
80
81 if isinstance(decrypted_text, bytes):
82 decrypted_text = decrypted_text.decode()
83
84 if MASTERPASS_CHECK_TEXT != decrypted_text:
85 return False
86 else:
87 return True
88 except Exception:
89 return False
90
91
92def set_masterpass_check_text(password, clear=False):

Callers 1

set_master_passwordFunction · 0.90

Calls 2

decryptFunction · 0.90
decodeMethod · 0.80

Tested by

no test coverage detected