Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# decorator for Flask application methods
def user_login_needed(f):
def decorated_function(*args, **kwargs):
is_user_logged_in = session['user_logged_in']
if not is_user_logged_in:
return redirect(url_for('login'))
return f(*args, **kwargs)
return decorated_function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.