Validate the password/key against the stored encrypted text :param password: password/key :return: Valid or not
(password)
| 69 | |
| 70 | |
| 71 | def 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 | |
| 92 | def set_masterpass_check_text(password, clear=False): |
no test coverage detected