コード例 #1
0
ファイル: register.py プロジェクト: stamigos/my-trio
    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
ファイル: register.py プロジェクト: stamigos/my-trio
 def _create_account(self, email, password):
     return Account.create(email=email, password=sha1(password).hexdigest())