diff --git a/data/users.py b/data/users.py index 9909c93..40c1380 100644 --- a/data/users.py +++ b/data/users.py @@ -29,8 +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 check_hash_password(self, password): + return True if password == self.password else False def set_password(self, password): self.password = generate_password_hash(password) diff --git a/main.py b/main.py index 59f21f5..9f013ac 100644 --- a/main.py +++ b/main.py @@ -742,12 +742,13 @@ def check_auth(): session = db_session.create_session() user = session.query(User).filter(User.email == email).first() if user: - if user.check_password(password) or user.check_hash_password(password): + if user.check_password(password) or user.check_hash_password(password): return make_response(jsonify({ - 'key': '', + 'key': open('key.txt', 'r', encoding='utf-8').read(), 'name': user.name, 'surname': user.surname, - 'login': user.login + 'login': user.login, + 'hash': user.password }), 200) else: return abort(403)