From 9f29c3e4e399be2205f33a14549b011d018b4849 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 3 Jul 2021 22:16:17 +0200 Subject: raise the minimum of characters of a password to 20 --- newspipe/templates/login.html | 2 +- newspipe/templates/signup.html | 7 ++++--- 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 @@

{{ _('Log In') }}

-
+ {{ form.hidden_tag() }}
{{ 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 @@
+

{{ _('Sign Up') }}

{{ form.hidden_tag() }}
{{ form.nickname(class_="form-control", placeholder=_('Your nickname')) }} + {{ _('Letters, numbers, dots and underscores only.') }} {% for error in form.nickname.errors %} {{ error }}
{% endfor %} -  {{ _('Letters, numbers, dots and underscores only.') }}

{{ form.email(class_="form-control", placeholder=_('Your email')) }} + {{ _("Only for account activation. Your email won't be stored.") }} {% for error in form.email.errors %} {{ error }}
{% endfor %} -  {{ _("Only for account activation. Your email won't be stored.") }}
{{ form.password(class_="form-control", placeholder=_('Your password')) }} + {{ _('Minimum 20 characters.') }} {% for error in form.password.errors %} {{ error }}
{% endfor %} -  {{ _('Minimum 6 characters.') }}

{{ 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")) -- cgit