Feat/enterprise sso (#3602)

This commit is contained in:
Garfield Dai 2024-04-18 17:33:32 +08:00 committed by GitHub
commit 4481906be2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 518 additions and 21 deletions

View file

@ -26,10 +26,13 @@ class LoginApi(Resource):
try:
account = AccountService.authenticate(args['email'], args['password'])
except services.errors.account.AccountLoginError:
return {'code': 'unauthorized', 'message': 'Invalid email or password'}, 401
except services.errors.account.AccountLoginError as e:
return {'code': 'unauthorized', 'message': str(e)}, 401
TenantService.create_owner_tenant_if_not_exist(account)
# SELF_HOSTED only have one workspace
tenants = TenantService.get_join_tenants(account)
if len(tenants) == 0:
return {'result': 'fail', 'data': 'workspace not found, please contact system admin to invite you to join in a workspace'}
AccountService.update_last_login(account, request)