Skip to content
Snippets Groups Projects
Commit 1ec93fa7 authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

Add message to confirm account for unconfirmed users

parent 68e1607a
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
{% 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 %}
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment