Exemplo n.º 1
0
    def validate(self):
        # 验证邮箱是否注册
        if wtf.Form.validate(self):
            user = get_user(email=self.email.data)
            if not user:
                self.email.errors.append(u'该邮箱尚未在本站注册')
            elif not user.check_password(self.password.data):
                self.password.errors.append(u'密码错误')
            else:
                self.user = user

        return len(self.errors) == 0
Exemplo n.º 2
0
    def validate(self):
        # 验证邮箱是否注册
        if wtf.Form.validate(self):
            user = get_user(email=self.email.data)
            if not user:
                self.email.errors.append(u'该邮箱尚未在本站注册')
            elif not user.check_password(self.password.data):
                self.password.errors.append(u'密码错误')
            else:
                self.user = user

        return len(self.errors) == 0
Exemplo n.º 3
0
    def validate(self):
        wtf.Form.validate(self)

        # 验证邮箱是否注册
        if not self.email.errors:
            user = get_user(email=self.email.data)
            user and self.email.errors.append(u'该邮箱已被注册')

        self.user = User(email=self.email.data, nickname=self.nickname.data, openids=[
            UserOpenID(provider=session['openid_provider'], openid=session['current_openid'])])
        self.user.set_password(self.password.data)
        self.user.info = UserInfo()

        return len(self.errors) == 0
Exemplo n.º 4
0
    def validate(self):
        wtf.Form.validate(self)

        # 验证邮箱是否注册
        if not self.email.errors:
            user = get_user(email=self.email.data)
            user and self.email.errors.append(u'该邮箱已被注册')

        self.user = User(email=self.email.data,
                         nickname=self.nickname.data,
                         openids=[
                             UserOpenID(provider=session['openid_provider'],
                                        openid=session['current_openid'])
                         ])
        self.user.set_password(self.password.data)
        self.user.info = UserInfo()

        return len(self.errors) == 0