mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Add page for password reset.
This commit is contained in:
parent
4ef5b480b1
commit
1a973bfbc6
@ -1,5 +1,5 @@
|
||||
from flask import flash, redirect, render_template, request, url_for
|
||||
from flask_login import login_required, login_user, logout_user
|
||||
from flask_login import current_user, login_required, login_user, logout_user
|
||||
from . import auth
|
||||
from .. import db
|
||||
from .forms import LoginForm, PasswordResetRequestForm, RegistrationForm
|
||||
@ -45,6 +45,8 @@ def register():
|
||||
|
||||
@auth.route('/reset', methods=['GET', 'POST'])
|
||||
def password_reset_request():
|
||||
if not current_user.is_anonymous:
|
||||
return redirect(url_for('main.index'))
|
||||
form = PasswordResetRequestForm()
|
||||
if form.validate_on_submit():
|
||||
user = User.query.filter_by(email=form.email.data.lower()).first()
|
||||
@ -56,4 +58,10 @@ def password_reset_request():
|
||||
flash('An email with instructions to reset your password has been '
|
||||
'sent to you.')
|
||||
return redirect(url_for('auth.login'))
|
||||
return render_template('auth/reset_password.html.j2', form=form, title='Password Reset')
|
||||
return render_template('auth/reset_password.html.j2', form=form,
|
||||
title='Password Reset')
|
||||
|
||||
|
||||
@auth.route('/reset/<token>')
|
||||
def password_reset(token):
|
||||
return 'test'
|
||||
|
@ -1,14 +1,20 @@
|
||||
{% extends "base.html.j2" %}
|
||||
|
||||
{% block page_content %}
|
||||
<div class="col s12 m6 offset-m3">
|
||||
<div class="card medium">
|
||||
<div class="col s12 m8 offset-m2">
|
||||
<div class="card small">
|
||||
<div class="card-content">
|
||||
<p>Sign in into an exisiting account or register a new one!</p>
|
||||
<br>
|
||||
<div class="card-action">
|
||||
<a class="btn" href="{{url_for('auth.register')}}">Register</a>
|
||||
</div>
|
||||
<span class="card-title">Reset Your Password</span>
|
||||
<form method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="input-field">
|
||||
{{ form.email(class='validate', type='email') }}
|
||||
{{ form.email.label }}
|
||||
</div>
|
||||
<div class="card-action">
|
||||
{{ form.submit(class='btn right') }}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user