From 68badd61e526fb28cabe52ea2c94ae802795dd4d Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 3 Jul 2021 22:36:05 +0200 Subject: updated bootstrap and various UI fixes --- newspipe/templates/profile.html | 10 +++++-- newspipe/templates/signup.html | 7 ++--- newspipe/web/forms.py | 31 ++++++++------------- package-lock.json | 61 ++++++++++++++++++++++++++++++----------- package.json | 4 +-- 5 files changed, 70 insertions(+), 43 deletions(-) diff --git a/newspipe/templates/profile.html b/newspipe/templates/profile.html index 12517331..6cb59ed5 100644 --- a/newspipe/templates/profile.html +++ b/newspipe/templates/profile.html @@ -40,13 +40,19 @@ {{ form.twitter.label }} {{ form.twitter(class_="form-control") }} {% for error in form.twitter.errors %} {{ error }}
{% endfor %} +
{{ form.is_public_profile.label }} - {{ form.is_public_profile(class_="form-control") }} {% for error in form.is_public_profile.errors %} {{ error }}
{% endfor %} + {{ form.is_public_profile(class_="form-check-input") }}

{{ _('Your profile will be available here.', url=url_for('user.profile_public', nickname=user.nickname) ) }}

+ {% for error in form.is_public_profile.errors %} {{ error }}
{% endfor %} +
+
{{ form.automatic_crawling.label }} - {{ form.automatic_crawling(class_="form-control") }} {% for error in form.automatic_crawling.errors %} {{ error }}
{% endfor %} + {{ form.automatic_crawling(class_="form-check-input") }}

{{ _('Uncheck if you are using your own crawler.') }}

+ {% for error in form.automatic_crawling.errors %} {{ error }}
{% endfor %} +
diff --git a/newspipe/templates/signup.html b/newspipe/templates/signup.html index 7189c186..c0cdbd15 100644 --- a/newspipe/templates/signup.html +++ b/newspipe/templates/signup.html @@ -9,19 +9,18 @@
{{ form.nickname(class_="form-control", placeholder=_('Your nickname')) }} {{ _('Letters, numbers, dots and underscores only.') }} - {% for error in form.nickname.errors %} {{ error }}
{% endfor %}
-

+ {% for error in form.nickname.errors %} {{ error }}
{% endfor %}
{{ 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 %}
+ {% for error in form.email.errors %} {{ error }}
{% endfor %}
{{ form.password(class_="form-control", placeholder=_('Your password')) }} {{ _('Minimum 20 characters.') }} - {% for error in form.password.errors %} {{ error }}
{% endfor %}
+ {% for error in form.password.errors %} {{ error }}
{% endfor %}
{{ form.submit(class_="btn btn-primary") }} diff --git a/newspipe/web/forms.py b/newspipe/web/forms.py index 33a8db70..71ebcd9c 100644 --- a/newspipe/web/forms.py +++ b/newspipe/web/forms.py @@ -199,20 +199,8 @@ class ProfileForm(FlaskForm): lazy_gettext("Nickname"), [validators.Required(lazy_gettext("Please enter your nickname."))], ) - 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), - ], - ) + password = PasswordField(lazy_gettext("Password")) + password_conf = PasswordField(lazy_gettext("Password")) automatic_crawling = BooleanField(lazy_gettext("Automatic crawling"), default=True) bio = TextAreaField(lazy_gettext("Bio")) webpage = URLField(lazy_gettext("Webpage")) @@ -222,11 +210,16 @@ class ProfileForm(FlaskForm): def validate(self): validated = super(ProfileForm, self).validate() - if self.password.data != self.password_conf.data: - message = lazy_gettext("Passwords aren't the same.") - self.password.errors.append(message) - self.password_conf.errors.append(message) - validated = False + if self.password.data: + if self.password.data != self.password_conf.data: + message = lazy_gettext("Passwords aren't the same.") + self.password.errors.append(message) + self.password_conf.errors.append(message) + validated = False + if not 20 <= len(self.password.data) <= 500: + message = lazy_gettext("Password must be between 20 and 500 characters.") + self.password.errors.append(message) + validated = False if self.nickname.data != User.make_valid_nickname(self.nickname.data): self.nickname.errors.append( lazy_gettext( diff --git a/package-lock.json b/package-lock.json index 9d5ea6db..de1bcc3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { - "@popperjs/core": "^2.9.1", - "bootstrap": "^5.0.0-beta3", + "@popperjs/core": "^2.9.2", + "bootstrap": "^5.0.2", "bootstrap-select": "^1.14.0-beta2", "fork-awesome": "^1.1.7", "moment": "^2.29.1" @@ -20,19 +20,34 @@ } }, "node_modules/@popperjs/core": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.1.tgz", - "integrity": "sha512-DvJbbn3dUgMxDnJLH+RZQPnXak1h4ZVYQ7CWiFWjQwBFkVajT4rfw2PdpHLTSTwxrYfnoEXkuBiwkDm6tPMQeA==" + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.2.tgz", + "integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } }, "node_modules/bootstrap": { - "version": "5.0.0-beta3", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0-beta3.tgz", - "integrity": "sha512-0urccjfIOzhrb9qJysN8XW/DRw6rg3zH7qLeKIp4Zyl8+Ens4JWB0NC0cB5AhnSFPd2tftRggjwCMxablo6Tpg==" + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.2.tgz", + "integrity": "sha512-1Ge963tyEQWJJ+8qtXFU6wgmAVj9gweEjibUdbmcCEYsn38tVwRk8107rk2vzt6cfQcRr3SlZ8aQBqaD8aqf+Q==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + }, + "peerDependencies": { + "@popperjs/core": "^2.9.2" + } }, "node_modules/bootstrap-select": { "version": "1.14.0-beta2", "resolved": "https://registry.npmjs.org/bootstrap-select/-/bootstrap-select-1.14.0-beta2.tgz", - "integrity": "sha512-Q63QUbConUwA+/Te7tCJcv0nE3SI/J+rNI5A1mdX1KxP6lW0pFQy+4KVP6VwgZEcwkoPfrwjvAo6WT7fdl+Sdg==" + "integrity": "sha512-Q63QUbConUwA+/Te7tCJcv0nE3SI/J+rNI5A1mdX1KxP6lW0pFQy+4KVP6VwgZEcwkoPfrwjvAo6WT7fdl+Sdg==", + "peerDependencies": { + "bootstrap": ">=3.0.0", + "jquery": "1.9.1 - 3" + } }, "node_modules/fork-awesome": { "version": "1.1.7", @@ -42,6 +57,12 @@ "node": ">=0.10.3" } }, + "node_modules/jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", + "peer": true + }, "node_modules/moment": { "version": "2.29.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", @@ -53,25 +74,33 @@ }, "dependencies": { "@popperjs/core": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.1.tgz", - "integrity": "sha512-DvJbbn3dUgMxDnJLH+RZQPnXak1h4ZVYQ7CWiFWjQwBFkVajT4rfw2PdpHLTSTwxrYfnoEXkuBiwkDm6tPMQeA==" + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.2.tgz", + "integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==" }, "bootstrap": { - "version": "5.0.0-beta3", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0-beta3.tgz", - "integrity": "sha512-0urccjfIOzhrb9qJysN8XW/DRw6rg3zH7qLeKIp4Zyl8+Ens4JWB0NC0cB5AhnSFPd2tftRggjwCMxablo6Tpg==" + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.2.tgz", + "integrity": "sha512-1Ge963tyEQWJJ+8qtXFU6wgmAVj9gweEjibUdbmcCEYsn38tVwRk8107rk2vzt6cfQcRr3SlZ8aQBqaD8aqf+Q==", + "requires": {} }, "bootstrap-select": { "version": "1.14.0-beta2", "resolved": "https://registry.npmjs.org/bootstrap-select/-/bootstrap-select-1.14.0-beta2.tgz", - "integrity": "sha512-Q63QUbConUwA+/Te7tCJcv0nE3SI/J+rNI5A1mdX1KxP6lW0pFQy+4KVP6VwgZEcwkoPfrwjvAo6WT7fdl+Sdg==" + "integrity": "sha512-Q63QUbConUwA+/Te7tCJcv0nE3SI/J+rNI5A1mdX1KxP6lW0pFQy+4KVP6VwgZEcwkoPfrwjvAo6WT7fdl+Sdg==", + "requires": {} }, "fork-awesome": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/fork-awesome/-/fork-awesome-1.1.7.tgz", "integrity": "sha512-IHI7XCSXrKfUIWslse8c/PaaVDT1oBaYge+ju40ihL2ooiQeBpTr4wvIXhgTd2NuhntlvX+M5jYHAPTzNlmv0g==" }, + "jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", + "peer": true + }, "moment": { "version": "2.29.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", diff --git a/package.json b/package.json index ddf28503..a8f52bbd 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "license": "AGPL-3.0", "private": true, "dependencies": { - "@popperjs/core": "^2.9.1", - "bootstrap": "^5.0.0-beta3", + "@popperjs/core": "^2.9.2", + "bootstrap": "^5.0.2", "bootstrap-select": "^1.14.0-beta2", "fork-awesome": "^1.1.7", "moment": "^2.29.1" -- cgit