def validate(self): print self.username.data rv = Form.validate(self) if not rv: return False user = User.objects(username=self.username.data).first() if user != None: self.username.errors = [Errors.USERNAME_UNAVAILABLE] return False if oid == None and user == None: user = User(openid=self.openid.data, username=self.username.data) user.save() self.username = user return True
def validate(self): print self.username.data rv = Form.validate(self) if not rv: return False if self.username.data != user.username: user = User.objects(username=self.username.data).first() if user != None: self.username.errors = [Errors.USERNAME_UNAVAILABLE] return False if self.username.data != user.username: email = User.objects(email=self.email.data).first() if email != None: self.email.errors = [Errors.EMAIL_IN_USE] return False self.username = user self.email = email return True
def validate(self): rv = Form.validate(self) if not rv: return False user = User.objects(openid=self.openid.data).first() if user is None: self.openid.errors = [Errors.UNKNOWN_USER] return False self.username = user return True