diff sat_website/forms.py @ 44:d721c8ffa22a

misc updates: - check for different passwords in registration form - update overview.html and features.html - add missing pages (to be completed)
author souliane <souliane@mailoo.org>
date Tue, 27 Jan 2015 18:28:06 +0100
parents 1a0f24401866
children 62c23067e86e
line wrap: on
line diff
--- a/sat_website/forms.py	Tue Feb 03 15:17:07 2015 +0100
+++ b/sat_website/forms.py	Tue Jan 27 18:28:06 2015 +0100
@@ -130,6 +130,15 @@
                 current_section.append(field)
         return sections
 
+    def clean(self):
+        cleaned_data = super(RegistrationForm, self).clean()
+        email = cleaned_data.get("email")
+        email_confirmation = cleaned_data.get("email_confirmation")
+
+        if email and email_confirmation and email != email_confirmation:
+            msg = _(u"Passwords don't match.")
+            self.add_error('email_confirmation', msg)
+
 
     def results(self, user_readable=True):
         """Get the results submitted by the user as a list of couple. Keep the