aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2021-07-03 22:36:05 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2021-07-03 22:36:05 +0200
commit68badd61e526fb28cabe52ea2c94ae802795dd4d (patch)
tree8be78aca0acbef67c581a29f815df4eb9564c6a9
parentraise the minimum of characters of a password to 20 (diff)
downloadnewspipe-68badd61e526fb28cabe52ea2c94ae802795dd4d.tar.gz
newspipe-68badd61e526fb28cabe52ea2c94ae802795dd4d.tar.bz2
newspipe-68badd61e526fb28cabe52ea2c94ae802795dd4d.zip
updated bootstrap and various UI fixes
-rw-r--r--newspipe/templates/profile.html10
-rw-r--r--newspipe/templates/signup.html7
-rw-r--r--newspipe/web/forms.py31
-rw-r--r--package-lock.json61
-rw-r--r--package.json4
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 %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ <div class="form-check">
{{ form.is_public_profile.label }}
- {{ form.is_public_profile(class_="form-control") }} {% for error in form.is_public_profile.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ {{ form.is_public_profile(class_="form-check-input") }}
<p>{{ _('Your profile will be available <a href="%(url)s">here</a>.', url=url_for('user.profile_public', nickname=user.nickname) ) }}</p>
+ {% for error in form.is_public_profile.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ </div>
+ <div class="form-check">
{{ form.automatic_crawling.label }}
- {{ form.automatic_crawling(class_="form-control") }} {% for error in form.automatic_crawling.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ {{ form.automatic_crawling(class_="form-check-input") }}
<p>{{ _('Uncheck if you are using your own crawler.') }}</p>
+ {% for error in form.automatic_crawling.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ </div>
</div>
</div>
<div class="row">
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 @@
<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 %}
</div>
- <p class="help-block"></p>
+ {% for error in form.nickname.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
<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 %}
</div>
+ {% for error in form.email.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
<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 %}
</div>
+ {% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
<br />
{{ form.submit(class_="btn btn-primary") }}
</form>
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"
bgstack15