aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-09-13 19:11:23 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2022-09-13 19:11:24 +0200
commit48256a6d62a78fbfc52eff302823f70cc268907e (patch)
treea3048e6697e9ef45ab1773bcfb2666c38f607633
parentupdate terms and add terms page link (diff)
downloadscout-subs-48256a6d62a78fbfc52eff302823f70cc268907e.tar.gz
scout-subs-48256a6d62a78fbfc52eff302823f70cc268907e.zip
account creation use default error text
-rw-r--r--accounts/views.py19
-rw-r--r--version.txt2
2 files changed, 4 insertions, 17 deletions
diff --git a/accounts/views.py b/accounts/views.py
index 4a0be18..22e287e 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -354,22 +354,9 @@ def signup(request):
else:
# get errors from form and add toasts
errors = form.errors.as_data()
- for field in errors.keys():
- if field == "username":
- out_errors.append("Il nome utente può contenere solo lettere e numeri")
- else:
- password_errors = errors["password2"]
- for err in password_errors:
- if err.code == "password_mismatch":
- out_errors.append("Le due password non sono uguali")
- elif err.code == "password_too_similar":
- out_errors.append("La password è troppo simile all'username")
- elif err.code == "password_too_short":
- out_errors.append("La password è troppo corta")
- elif err.code == "password_too_common":
- out_errors.append("La password è troppo comune")
- elif err.code == "password_entirely_numeric":
- out_errors.append("La password deve contenere lettere")
+ errors_list = [x for xs in errors.values() for x in xs]
+ errors_text = list(map(lambda x: x.message, errors_list))
+ out_errors += errors_text
else:
# create empty form to be filled
diff --git a/version.txt b/version.txt
index b8dce7b..6239158 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.6
-rev=2
+rev=3