mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 03:10:00 +00:00
Moved the login_required logic to a new utils.py for reuse. Added a new auth blueprint and registered it in app.py. Updated user blueprint to use the shared login_required function.
12 lines
353 B
Python
12 lines
353 B
Python
from flask_login import current_user
|
|
from flask import redirect, url_for, flash
|
|
|
|
|
|
def login_required():
|
|
if not current_user.is_authenticated:
|
|
return redirect(url_for("auth.login"))
|
|
if current_user.must_change_password:
|
|
flash("You have to change your password")
|
|
return redirect(url_for("auth.change_password"))
|
|
return
|