Development
This commit is contained in:
parent
8a8e947fcf
commit
450c0081f7
9 changed files with 59 additions and 28 deletions
|
|
@ -1,6 +1,5 @@
|
|||
from pathlib import Path
|
||||
from flask import Blueprint, request, session, redirect, flash
|
||||
import bcrypt
|
||||
import auth
|
||||
import config_utils
|
||||
import sanitize
|
||||
|
|
@ -131,11 +130,11 @@ def changepassword_save():
|
|||
flash('New password must be at least 8 characters.', 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
||||
hashed = bcrypt.hashpw(new_password.encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
|
||||
hashed = settings.hash_password(new_password)
|
||||
|
||||
if settings.is_single_user():
|
||||
stored_hash = settings.get_initial_manager_password_hash()
|
||||
if not stored_hash or not bcrypt.checkpw(current_password.encode('utf-8'), stored_hash.encode('utf-8')):
|
||||
if not stored_hash or not settings.verify_password(current_password, stored_hash):
|
||||
flash('Current password is incorrect.', 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
try:
|
||||
|
|
@ -156,7 +155,7 @@ def changepassword_save():
|
|||
flash('Account not found. Please log in again.', 'error')
|
||||
return redirect('/accountlogin')
|
||||
|
||||
if not bcrypt.checkpw(current_password.encode('utf-8'), account['hashed_password'].encode('utf-8')):
|
||||
if not settings.verify_password(current_password, account['hashed_password']):
|
||||
flash('Current password is incorrect.', 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue