Skip to content
Snippets Groups Projects
Commit 22f96055 authored by danielmyren's avatar danielmyren
Browse files

Remove the login function (its moved to the default bp)

parent b204453c
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment