mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 18:34:18 +00:00
Add message to confirm account for unconfirmed users
This commit is contained in:
parent
68e1607af3
commit
1ec93fa7d6
@ -62,6 +62,32 @@ def confirm(token):
|
|||||||
return redirect(url_for('main.index'))
|
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'])
|
@auth.route('/reset', methods=['GET', 'POST'])
|
||||||
def password_reset_request():
|
def password_reset_request():
|
||||||
if not current_user.is_anonymous:
|
if not current_user.is_anonymous:
|
||||||
|
20
app/templates/auth/unconfirmed.html.j2
Normal file
20
app/templates/auth/unconfirmed.html.j2
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{% extends "base.html.j2" %}
|
||||||
|
|
||||||
|
{% block title %}Opaque - Confirm your account{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<div class="page-header">
|
||||||
|
<h1>
|
||||||
|
Hello, {{ current_user.username }}!
|
||||||
|
</h1>
|
||||||
|
<h3>You have not confirmed your account yet.</h3>
|
||||||
|
<p>
|
||||||
|
Before you can access this site you need to confirm your account.
|
||||||
|
Check your inbox, you should have received an email with a confirmation link.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Need another confirmation email?
|
||||||
|
<a href="{{ url_for('auth.resend_confirmation') }}">Click here</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
BIN
data_dev.sqlite
BIN
data_dev.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user