diff --git a/pear_admin/extensions/init_jwt.py b/pear_admin/extensions/init_jwt.py index 7b1a881..3d077b6 100644 --- a/pear_admin/extensions/init_jwt.py +++ b/pear_admin/extensions/init_jwt.py @@ -14,7 +14,7 @@ def user_identity_lookup(user): @jwt.user_lookup_loader def user_lookup_callback(_jwt_header, jwt_data): identity = jwt_data["sub"] - return UserORM.query.filter_by(id=identity).one_or_none() + return UserORM.query.filter(UserORM.id == identity).one_or_none() @jwt.expired_token_loader diff --git a/static/js/pear_admin_flask.js b/static/js/pear_admin_flask.js new file mode 100644 index 0000000..95f4a83 --- /dev/null +++ b/static/js/pear_admin_flask.js @@ -0,0 +1,10 @@ +function getCookie(name) { + let matches = document.cookie.match( + new RegExp( + "(?:^|; )" + + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + + "=([^;]*)", + ), + ); + return matches ? decodeURIComponent(matches[1]) : undefined; +} diff --git a/templates/includes/script.html b/templates/includes/script.html deleted file mode 100644 index 1da6642..0000000 --- a/templates/includes/script.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/templates/index.html b/templates/index.html index 2afa7fc..363d56f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,15 @@ content="width=device-width, initial-scale=1, maximum-scale=1" /> Pear Admin Flask - {% include 'includes/script.html' %} + + + + + + + + + diff --git a/templates/login.html b/templates/login.html index 4d2c5c9..a86d1fa 100644 --- a/templates/login.html +++ b/templates/login.html @@ -70,20 +70,6 @@ /> -