Skip to content

Commit

Permalink
Remove scheme_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
nextgens committed Mar 9, 2021
1 parent 45e5cb9 commit 1c5b58c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions core/admin/mailu/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,6 @@ def reply_active(self):
self.reply_enddate > now
)

scheme_dict = {'PBKDF2': "pbkdf2_sha512",
'BLF-CRYPT': "bcrypt",
'SHA512-CRYPT': "sha512_crypt",
'SHA256-CRYPT': "sha256_crypt",
'MD5-CRYPT': "md5_crypt",
'CRYPT': "des_crypt"}

def get_password_context(self):
schemes = registry.list_crypt_handlers()
# scrypt throws a warning if the native wheels aren't found
Expand All @@ -392,7 +385,7 @@ def check_password(self, password):
# on its own
if self.password.startswith("{"):
scheme = self.password.split('}')[0][1:]
if scheme in self.scheme_dict:
if scheme in ['PBKDF2', 'BLF-CRYPT', 'SHA512-CRYPT', 'SHA256-CRYPT', 'MD5-CRYPT', 'CRYPT']:
reference = reference[len(scheme)+2:]

result, new_hash = context.verify_and_update(password, reference)
Expand Down

0 comments on commit 1c5b58c

Please sign in to comment.