blob: 28312ecf63225a4c677b14aefcdc82281234c84b [file] [log] [blame]
from functools import wraps
from flask import flash, redirect, url_for
from flask_login import current_user
def check_confirmed(func):
@wraps(func)
def decorated_function(*args, **kwargs):
if not current_user.confirmed:
return redirect(url_for('user.unconfirmed'))
return func(*args, **kwargs)
return decorated_function
def check_sshkey(func):
@wraps(func)
def decorated_function(*args, **kwargs):
if current_user.ssh_public_key is None:
return redirect(url_for('user.profile'))
if not current_user.ssh_public_key:
return redirect(url_for('user.profile'))
return func(*args, **kwargs)
return decorated_function