From 22f960556ee9b19c2cddf9ab85f4781ee7082657 Mon Sep 17 00:00:00 2001 From: danielmyren <daniel.j.myren@gmail.com> Date: Wed, 1 May 2024 23:17:00 +0200 Subject: [PATCH] Remove the login function (its moved to the default bp) --- backend/routes_auth.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/backend/routes_auth.py b/backend/routes_auth.py index 7c98bf3..bd370d5 100644 --- a/backend/routes_auth.py +++ b/backend/routes_auth.py @@ -3,25 +3,15 @@ from flask_security import auth_required, logout_user, verify_password, login_us auth = Blueprint("auth", __name__) -@auth.route("/login", methods=["POST"]) -def login(): - if request.method == 'POST': - data = request.get_json() - unorm = current_app.security._username_util.normalize(data["username"]) - user = current_app.security.datastore.find_user(username=unorm) - if user is not None: - pnorm = current_app.security._password_util.normalize(data["password"]) - - # Compare the supplied hash with the stored hash for the user - if verify_password(pnorm, user.password): - login_user(user, remember=False) - return jsonify(success=True) - else: - return jsonify(success=False, message="Invalid username or password") - @auth.route("/logout", methods=["POST"]) @auth_required() def logout(): logout_user() return jsonify(success=True) + + +@auth.route("/api/stats") +@auth_required() +def get_data(): + pass \ No newline at end of file -- GitLab