diff --git a/ereuse_devicehub/forms.py b/ereuse_devicehub/forms.py index 5c2b8d15..d88c9cf1 100644 --- a/ereuse_devicehub/forms.py +++ b/ereuse_devicehub/forms.py @@ -1,15 +1,14 @@ from flask_wtf import FlaskForm from werkzeug.security import generate_password_hash -from wtforms import EmailField, PasswordField, validators +from wtforms import BooleanField, EmailField, PasswordField, validators from ereuse_devicehub.resources.user.models import User class LoginForm(FlaskForm): email = EmailField('Email Address', [validators.Length(min=6, max=35)]) - password = PasswordField('Password', [ - validators.DataRequired(), - ]) + password = PasswordField('Password', [validators.DataRequired()]) + remember = BooleanField('Remember me') error_messages = { 'invalid_login': ( diff --git a/ereuse_devicehub/templates/ereuse_devicehub/user_login.html b/ereuse_devicehub/templates/ereuse_devicehub/user_login.html index 8c193062..a096dc7a 100644 --- a/ereuse_devicehub/templates/ereuse_devicehub/user_login.html +++ b/ereuse_devicehub/templates/ereuse_devicehub/user_login.html @@ -34,12 +34,9 @@ {{ form.csrf_token }}
- -
- @ - -
Please enter your username.
-
+ + +
Please enter your email.
@@ -50,7 +47,7 @@
- +
diff --git a/ereuse_devicehub/views.py b/ereuse_devicehub/views.py index 8e1ea877..8578ae01 100644 --- a/ereuse_devicehub/views.py +++ b/ereuse_devicehub/views.py @@ -20,7 +20,7 @@ class LoginView(View): # Login and validate the user. # user should be an instance of your `User` class user = User.query.filter_by(email=form.email.data).first() - login_user(user) + login_user(user, remember=form.remember.data) next_url = flask.request.args.get('next') # is_safe_url should check if the url is safe for redirects.