aboutsummaryrefslogtreecommitdiff
path: root/src/web/forms.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2018-07-01 21:11:46 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2018-07-01 21:11:46 +0200
commit3365ddd7de2d4a68d38fd3b25eccbd58080c9352 (patch)
treeb8869206a5485d0a2490e95b32bee0e4227e8269 /src/web/forms.py
parentRemoved a now useless route. (diff)
downloadnewspipe-3365ddd7de2d4a68d38fd3b25eccbd58080c9352.tar.gz
newspipe-3365ddd7de2d4a68d38fd3b25eccbd58080c9352.tar.bz2
newspipe-3365ddd7de2d4a68d38fd3b25eccbd58080c9352.zip
Validate the nickname of the user before account creation.
Diffstat (limited to 'src/web/forms.py')
-rw-r--r--src/web/forms.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/web/forms.py b/src/web/forms.py
index eb571cc8..96953240 100644
--- a/src/web/forms.py
+++ b/src/web/forms.py
@@ -60,6 +60,11 @@ class SignupForm(Form):
if ucontr.read(nickname=self.nickname.data).count():
self.nickname.errors.append('Nickname already taken')
validated = False
+ if self.nickname.data != User.make_valid_nickname(self.nickname.data):
+ self.nickname.errors.append(lazy_gettext(
+ 'This nickname has invalid characters. '
+ 'Please use letters, numbers, dots and underscores only.'))
+ validated = False
return validated
bgstack15