Добавлено сравнение по хешу пароля в функцию check_auth
This commit is contained in:
parent
239c03eefa
commit
1c4e74c2ca
@ -29,5 +29,8 @@ class User(SqlAlchemyBase, UserMixin):
|
||||
def check_password(self, password):
|
||||
return check_password_hash(self.password, password)
|
||||
|
||||
def check_hash_password(self, hash_password):
|
||||
return True if self.password == hash_password else False
|
||||
|
||||
def set_password(self, password):
|
||||
self.password = generate_password_hash(password)
|
||||
|
||||
2
main.py
2
main.py
@ -742,7 +742,7 @@ def check_auth():
|
||||
session = db_session.create_session()
|
||||
user = session.query(User).filter(User.email == email).first()
|
||||
if user:
|
||||
if user.check_password(password):
|
||||
if user.check_password(password) or user.check_hash_password(password):
|
||||
return make_response(jsonify({
|
||||
'key': '',
|
||||
'name': user.name,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user