Fatih Degirmenci | c2a4601 | 2019-09-30 12:07:45 +0200 | [diff] [blame^] | 1 | from functools import wraps |
| 2 | from flask import flash, redirect, url_for |
| 3 | from flask_login import current_user |
| 4 | |
| 5 | def 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 | |
| 14 | def check_sshkey(func): |
| 15 | @wraps(func) |
| 16 | def decorated_function(*args, **kwargs): |
| 17 | if current_user.ssh_public_key is None: |
| 18 | return redirect(url_for('user.profile')) |
| 19 | return func(*args, **kwargs) |
| 20 | |
| 21 | return decorated_function |