mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 09:00:40 +00:00
Add message to confirm account for unconfirmed users
This commit is contained in:
@ -62,6 +62,32 @@ def confirm(token):
|
||||
return redirect(url_for('main.index'))
|
||||
|
||||
|
||||
@auth.before_app_request
|
||||
def before_request():
|
||||
if current_user.is_authenticated \
|
||||
and not current_user.confirmed \
|
||||
and request.blueprint != 'auth' \
|
||||
and request.blueprint != 'static':
|
||||
return redirect(url_for('auth.unconfirmed'))
|
||||
|
||||
|
||||
@auth.route('/unconfirmed')
|
||||
def unconfirmed():
|
||||
if current_user.is_anonymous or current_user.confirmed:
|
||||
return redirect(url_for('main.index'))
|
||||
return render_template('auth/unconfirmed.html.j2')
|
||||
|
||||
|
||||
@auth.route('/confirm')
|
||||
@login_required
|
||||
def resend_confirmation():
|
||||
token = current_user.generate_confirmation_token()
|
||||
send_email(current_user.email, 'Confirm Your Account', 'auth/email/confirm',
|
||||
user=current_user, token=token)
|
||||
flash('A new confirmation email has benn sent to you by email.')
|
||||
return redirect(url_for('maind.index'))
|
||||
|
||||
|
||||
@auth.route('/reset', methods=['GET', 'POST'])
|
||||
def password_reset_request():
|
||||
if not current_user.is_anonymous:
|
||||
|
Reference in New Issue
Block a user