Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# decorator for Flask application methods
def user_login_needed(f):
@wraps(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'))
else:
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.