blob: 28312ecf63225a4c677b14aefcdc82281234c84b [file] [log] [blame]
Fatih Degirmencic2a46012019-09-30 12:07:45 +02001from functools import wraps
2from flask import flash, redirect, url_for
3from flask_login import current_user
4
5def check_confirmed(func):
6 @wraps(func)
7 def decorated_function(*args, **kwargs):
8 if not current_user.confirmed:
9 return redirect(url_for('user.unconfirmed'))
10 return func(*args, **kwargs)
11
12 return decorated_function
13
14def check_sshkey(func):
15 @wraps(func)
16 def decorated_function(*args, **kwargs):
Fatih Degirmenci89e4ac92019-10-01 07:41:29 +000017 if current_user.ssh_public_key is None:
18 return redirect(url_for('user.profile'))
19 if not current_user.ssh_public_key:
Fatih Degirmencic2a46012019-09-30 12:07:45 +020020 return redirect(url_for('user.profile'))
21 return func(*args, **kwargs)
22
23 return decorated_function