Esempio n. 1
0
 def signup():
     if current_user.is_authenticated:
         return redirect('/')
     form = SignUp()
     if form.validate_on_submit():
         user = User(email=form.email.data)
         user.password = form.password.data
         user.save()
         login_user(user)
         return redirect('/')
     return render_template('signup.html', signup_form=form)
Esempio n. 2
0
    def __call__(self, form, field):
        exists = User.objects(email=field.data).first()
        if self._email_should_exist and not exists:
            raise ValidationError(self._message or u'Email not found.')

        if not self._email_should_exist and exists:
            raise ValidationError(self._message or u'Email exists.')
Esempio n. 3
0
 def get_user(self):
     return User.objects(email=self.email.data).first()
Esempio n. 4
0
 def get_user(self):
     return User.objects(email=self.email.data).first()