mirror of
https://github.com/Mailu/Mailu.git
synced 2024-12-14 10:53:30 +02:00
Remove {scheme} from the DB if mailu has set it
This commit is contained in:
parent
7137ba6ff1
commit
57a6abaf50
@ -386,10 +386,14 @@ class User(Base, Email):
|
||||
|
||||
def check_password(self, password):
|
||||
context = self.get_password_context()
|
||||
# {scheme} will most likely be migrated on first use
|
||||
reference = self.password
|
||||
# strip {scheme} if that's something mailu has added
|
||||
# passlib will identify *crypt based hashes just fine
|
||||
# on its own
|
||||
if self.password.startswith("{"):
|
||||
reference = re.match('({[^}]+})?(.*)', reference).group(2)
|
||||
scheme = self.password.split('}')[0][1:]
|
||||
if scheme in scheme_dict:
|
||||
reference = reference[len(scheme)+2:]
|
||||
|
||||
result, new_hash = context.verify_and_update(password, reference)
|
||||
if new_hash:
|
||||
|
Loading…
Reference in New Issue
Block a user