From 76b0ed0ae491480535372ef125e7874e5661744f Mon Sep 17 00:00:00 2001
From: Flavio Tarsetti <flavio.tarsetti@idiap.ch>
Date: Mon, 17 Jul 2017 15:26:38 +0200
Subject: [PATCH] [ui] patched registration forms in case of invalid godfather
 (blocked status)

---
 beat/web/ui/registration/forms.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/beat/web/ui/registration/forms.py b/beat/web/ui/registration/forms.py
index 26e7390d4..14409816b 100644
--- a/beat/web/ui/registration/forms.py
+++ b/beat/web/ui/registration/forms.py
@@ -107,6 +107,8 @@ class RegistrationForm(forms.Form):
         """
         try:
             user = User.objects.get(username__iexact=self.cleaned_data['godfather'])
+            if user.profile.status == Profile.BLOCKED:
+                raise forms.ValidationError(_(u'This user is not a valid godfather. Please choose another.'))
         except User.DoesNotExist:
             raise forms.ValidationError(_(u'This godfather username does not exist. Please choose another.'))
 
-- 
GitLab