def validate(self): if not Form.validate(self): return False user = User.query.filter_by(email = self.email.data.lower()).first() if user: if user.check_password(self.password.data): return True else: self.email.errors.append("Bad Login.") else: # register client = UserSession() client.user = User(self.email.data.lower(), self.password.data) client.register() return True
def validate(self): if not Form.validate(self): return False else: client = UserSession() user_domain = client.user.openaliases[0].domain user_recipient_address = client.user.openaliases[0].recipient_address client.user.openaliases[0].domain = self.domain.data.lower() client.user.openaliases[0].recipient_address = self.address.data sync = client.trySyncUserLinode() # check if domain is editable by this user if sync: return True else: self.domain.errors.append(client.linodeSyncMessage) client.user.openaliases[0].domain = user_domain if utilities.isNullOrEmpty(client.user.openaliases[0].recipient_address): client.user.openaliases[0].recipient_address = self.address.data return False return False