Rename account form.

This commit is contained in:
Patrick Jentsch 2019-07-09 14:53:17 +02:00
parent 3187cca1af
commit 7f76e7884f
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class PasswordResetRequestForm(FlaskForm):
submit = SubmitField('Reset Password') submit = SubmitField('Reset Password')
class ChangeProfileForm(FlaskForm): class ChangeAccountForm(FlaskForm):
email = StringField('Email', validators=[Optional(), Length(1, 64), email = StringField('Email', validators=[Optional(), Length(1, 64),
Email()]) Email()])
username = StringField('Username', validators=[ username = StringField('Username', validators=[

View File

@ -2,7 +2,7 @@ from flask import flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required, login_user, logout_user from flask_login import current_user, login_required, login_user, logout_user
from . import auth from . import auth
from .. import db from .. import db
from .forms import ChangeProfileForm, LoginForm, PasswordResetForm, PasswordResetRequestForm, RegistrationForm from .forms import ChangeAccountForm, LoginForm, PasswordResetForm, PasswordResetRequestForm, RegistrationForm
from ..email import send_email from ..email import send_email
from ..models import User from ..models import User
@ -20,7 +20,7 @@ def login():
if next is None or not next.startswith('/'): if next is None or not next.startswith('/'):
next = url_for('main.index') next = url_for('main.index')
return redirect(next) return redirect(next)
flash('Invalid username or password.') flash('<span class="red-text">Invalid username or password.</span>')
return render_template('auth/login.html.j2', form=form, title='Log in') return render_template('auth/login.html.j2', form=form, title='Log in')
@ -128,7 +128,7 @@ def password_reset(token):
@auth.route('/account', methods=['GET', 'POST']) @auth.route('/account', methods=['GET', 'POST'])
@login_required @login_required
def account(): def account():
form = ChangeProfileForm() form = ChangeAccountForm()
if form.validate_on_submit(): if form.validate_on_submit():
flash('It is just a test, nothing changed.') flash('It is just a test, nothing changed.')
if form.username.data: if form.username.data: