def _verify_email(self, form): if not form.email.data: raise ServiceException("Email required") try: Account.get(Account.email == form.email.data) # или возвращать объект account, предлагать восстановить пароль raise ServiceException("Email already registered") except Account.DoesNotExist: return form.email.data
def _verify_account(self, form): if not form['email']: raise ServiceException("Email required") try: account = Account.get(Account.email == form['email']) return account except Account.DoesNotExist: raise ServiceException('Account does not exist')
def _create_account(self, email, password): return Account.create(email=email, password=sha1(password).hexdigest())