Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8745634

Browse files
authored
Update rest.py
1 parent eff7df0 commit 8745634

File tree

1 file changed

+3
-3
lines changed
  • python-flask-rest-api-jwt-auth

1 file changed

+3
-3
lines changed

python-flask-rest-api-jwt-auth/rest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from db_conf import mysql
44
from flask import jsonify
55
from flask_jwt import JWT, jwt_required, current_identity
6-
from werkzeug import generate_password_hash, check_password_hash
6+
from werkzeug.security import generate_password_hash, check_password_hash
77

88
class User(object):
99
def __init__(self, id, username):
@@ -47,7 +47,7 @@ def identity(payload):
4747
try:
4848
conn = mysql.connect()
4949
cursor = conn.cursor(pymysql.cursors.DictCursor)
50-
cursor.execute("SELECT id, username, password FROM user WHERE id=%s", payload['identity'])
50+
cursor.execute("SELECT id, username FROM user WHERE id=%s", payload['identity'])
5151
row = cursor.fetchone()
5252

5353
if row:
@@ -65,4 +65,4 @@ def identity(payload):
6565
jwt = JWT(app, authenticate, identity)
6666

6767
if __name__ == "__main__":
68-
app.run()
68+
app.run()

0 commit comments

Comments
 (0)