Skip to content

Commit

Permalink
use flashed message instead of dedicated template for logging in outs…
Browse files Browse the repository at this point in the history
…ide event times
  • Loading branch information
Kunsi committed Dec 24, 2024
1 parent be7c8ce commit 6aeebd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
5 changes: 3 additions & 2 deletions frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def oauth2_callback(provider):
userinfo_json = r.json()

if not SSO_CONFIG[provider]["functions"]["login_allowed"](userinfo_json):
flash("You are not allowed to log in at this time.", "warning")
flash("You are not allowed to log in.", "warning")
return redirect(url_for("faq", _anchor="signup"))

userid = SSO_CONFIG[provider]["functions"]["userid"](userinfo_json)
Expand All @@ -266,7 +266,8 @@ def oauth2_callback(provider):
REDIS.set(f"admin:{userid}", "1" if user_is_admin else "0")

if not (user_is_admin or user_without_limits or is_within_timeframe()):
return render_template("time_error.jinja")
flash("You are trying to log in outside the configured time frame.", "warning")
return redirect(url_for("index"))

session["oauth2_provider"] = provider
session["oauth2_userinfo"] = userinfo_json
Expand Down
10 changes: 0 additions & 10 deletions templates/time_error.jinja

This file was deleted.

0 comments on commit 6aeebd7

Please sign in to comment.