diff options
-rw-r--r-- | newspipe/templates/login.html | 2 | ||||
-rw-r--r-- | newspipe/templates/signup.html | 7 | ||||
-rw-r--r-- | newspipe/web/forms.py | 28 |
3 files changed, 28 insertions, 9 deletions
diff --git a/newspipe/templates/login.html b/newspipe/templates/login.html index 94037d81..5d936d18 100644 --- a/newspipe/templates/login.html +++ b/newspipe/templates/login.html @@ -4,7 +4,7 @@ <div class="row justify-content-center"> <div class="col-md-6"> <h2>{{ _('Log In') }}</h2> - <form action="{{ url_for('login') }}" method=post> + <form action="{{ url_for('login') }}" method="post"> {{ form.hidden_tag() }} <div class="input-group mb-3"> {{ form.nickmane(class_="form-control", placeholder=_('Your nickname')) }} diff --git a/newspipe/templates/signup.html b/newspipe/templates/signup.html index 68ebbb6a..7189c186 100644 --- a/newspipe/templates/signup.html +++ b/newspipe/templates/signup.html @@ -3,23 +3,24 @@ <div class="container"> <div class="row justify-content-center"> <div class="col-md-6"> + <h2>{{ _('Sign Up') }}</h2> <form action="" method="post" name="save"> {{ form.hidden_tag() }} <div class="input-group mb-3"> {{ form.nickname(class_="form-control", placeholder=_('Your nickname')) }} + <span class="input-group-text">{{ _('Letters, numbers, dots and underscores only.') }}</span> {% for error in form.nickname.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} - <span class="text-muted">{{ _('Letters, numbers, dots and underscores only.') }}</span> </div> <p class="help-block"></p> <div class="input-group mb-3"> {{ form.email(class_="form-control", placeholder=_('Your email')) }} + <span class="input-group-text">{{ _("Only for account activation. Your email won't be stored.") }}</span> {% for error in form.email.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} - <span class="text-muted">{{ _("Only for account activation. Your email won't be stored.") }}</span> </div> <div class="input-group mb-3"> {{ form.password(class_="form-control", placeholder=_('Your password')) }} + <span class="input-group-text">{{ _('Minimum 20 characters.') }}</span> {% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} - <span class="text-muted">{{ _('Minimum 6 characters.') }}</span> </div> <br /> {{ form.submit(class_="btn btn-primary") }} diff --git a/newspipe/web/forms.py b/newspipe/web/forms.py index ad9cca43..33a8db70 100644 --- a/newspipe/web/forms.py +++ b/newspipe/web/forms.py @@ -73,7 +73,7 @@ class SignupForm(FlaskForm): lazy_gettext("Password"), [ validators.Required(lazy_gettext("Please enter a password.")), - validators.Length(min=6, max=100), + validators.Length(min=20, max=500), ], ) submit = SubmitField(lazy_gettext("Sign up")) @@ -130,7 +130,7 @@ class SigninForm(RedirectForm): lazy_gettext("Password"), [ validators.Required(lazy_gettext("Please enter a password.")), - validators.Length(min=6, max=100), + validators.Length(min=6, max=500), ], ) submit = SubmitField(lazy_gettext("Log In")) @@ -167,7 +167,13 @@ class UserForm(FlaskForm): lazy_gettext("Nickname"), [validators.Required(lazy_gettext("Please enter your nickname."))], ) - password = PasswordField(lazy_gettext("Password")) + password = PasswordField( + lazy_gettext("Password"), + [ + validators.Required(lazy_gettext("Please enter a password.")), + validators.Length(min=20, max=500), + ], + ) automatic_crawling = BooleanField(lazy_gettext("Automatic crawling"), default=True) submit = SubmitField(lazy_gettext("Save")) @@ -193,8 +199,20 @@ class ProfileForm(FlaskForm): lazy_gettext("Nickname"), [validators.Required(lazy_gettext("Please enter your nickname."))], ) - password = PasswordField(lazy_gettext("Password")) - password_conf = PasswordField(lazy_gettext("Password Confirmation")) + password = PasswordField( + lazy_gettext("Password"), + [ + validators.Required(lazy_gettext("Please enter a password.")), + validators.Length(min=20, max=500), + ], + ) + password_conf = PasswordField( + lazy_gettext("Password"), + [ + validators.Required(lazy_gettext("Please enter a password.")), + validators.Length(min=20, max=500), + ], + ) automatic_crawling = BooleanField(lazy_gettext("Automatic crawling"), default=True) bio = TextAreaField(lazy_gettext("Bio")) webpage = URLField(lazy_gettext("Webpage")) |