示例#1
0
    def clean_email(self):
        email = normalizeemail(self.cleaned_data['email'])
        user = User.all().filter('email =', email).fetch(limit=1)
        if user:
            raise forms.ValidationError(_(u"This email address is already registered"))

        if email not in settings.ADMINS_EMAILS:
            raise forms.ValidationError(_(u"Can not register user with given email"))

        return self.cleaned_data['email']
示例#2
0
 def clean_email(self):
     """
     Validates that a user exists with the given e-mail address.
     """
     email = self.cleaned_data["email"]
     self.user = None
     user = User.all().filter('email =', email).run(limit=1)
     if user:
         self.user = user[0]
     if self.user is None:
         raise forms.ValidationError(_("That e-mail address doesn't have an associated user account. Are you sure you've registered?"))
     return email