From 1c4e74c2cac365356443e383ca8d915b83d1d086 Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 19 Oct 2022 00:02:34 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=81=D1=80=D0=B0=D0=B2=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=BE=20=D1=85=D0=B5=D1=88=D1=83=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D0=BE=D0=BB=D1=8F=20=D0=B2=20=D1=84=D1=83=D0=BD=D0=BA?= =?UTF-8?q?=D1=86=D0=B8=D1=8E=20check=5Fauth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/users.py | 3 +++ main.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/data/users.py b/data/users.py index e5ceedb..9909c93 100644 --- a/data/users.py +++ b/data/users.py @@ -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) diff --git a/main.py b/main.py index ba190e9..59f21f5 100644 --- a/main.py +++ b/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,