示例#1
0
文件: auth.py 项目: Lunchable/eat
 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)
示例#2
0
文件: __init__.py 项目: Lunchable/eat
    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.')
示例#3
0
文件: auth.py 项目: Lunchable/eat
 def get_user(self):
     return User.objects(email=self.email.data).first()
示例#4
0
文件: auth.py 项目: Lunchable/eat
 def get_user(self):
     return User.objects(email=self.email.data).first()