Skip to content

Commit

Permalink
fix login page
Browse files Browse the repository at this point in the history
  • Loading branch information
klementng committed Jan 26, 2024
1 parent 6d7f9a8 commit 0c0e253
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions server/core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def main(path):
else:
if 'login' in request.args:
return render_template("index.html"), 401

else:
return abort(401)

Expand Down Expand Up @@ -141,20 +142,20 @@ def unauthorized(e: werkzeug.exceptions.Unauthorized) -> Response:

m = auth_modules.get(request.path)

if m != None:
return Response(
str(e),
401,
{'WWW-Authenticate': f'{m.method} realm="{m.realm}"'}
)

if 'login' in request.args:
flask.flash("Incorrect username or password")
return Response(
render_template("index.html"),
401
)

elif m != None:
return Response(
str(e),
401,
{'WWW-Authenticate': f'{m.method} realm="{m.realm}"'}
)

else:
return abort(404, f"{request.path} is not defined. Check your nginx config!!!")

Expand Down

0 comments on commit 0c0e253

Please sign in to comment.