diff --git a/app/auth/views.py b/app/auth/views.py index 417aae5084e931ee624b0e82484afe78c42c3b68..b14e5fb940a0113d01a8a126be51d43f85edf039 100644 --- a/app/auth/views.py +++ b/app/auth/views.py @@ -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' diff --git a/app/templates/auth/reset_password.html.j2 b/app/templates/auth/reset_password.html.j2 index 782a1f775706d6982870c7884d35bd4ffd9ed1d4..bb9cfe74f1aa8cc673cf9683428a6924e277d5b1 100644 --- a/app/templates/auth/reset_password.html.j2 +++ b/app/templates/auth/reset_password.html.j2 @@ -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>