示例#1
0
    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
示例#2
0
文件: login.py 项目: stamigos/my-trio
    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')
示例#3
0
 def _create_account(self, email, password):
     return Account.create(email=email, password=sha1(password).hexdigest())