aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
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 /accounts
parentupdate terms and add terms page link (diff)
downloadscout-subs-48256a6d62a78fbfc52eff302823f70cc268907e.tar.gz
scout-subs-48256a6d62a78fbfc52eff302823f70cc268907e.zip
account creation use default error text
Diffstat (limited to 'accounts')
-rw-r--r--accounts/views.py19
1 files changed, 3 insertions, 16 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