fix login error

pull/21891/head
ytqh 1 year ago
parent 7102fe396c
commit a9f06f219b

@ -70,6 +70,7 @@ class EmailCodeLoginSendEmailApi(Resource):
email: email:
type: string type: string
description: The user's email description: The user's email
example: "test@test.edu"
language: language:
type: string type: string
description: Preferred language for the email description: Preferred language for the email
@ -139,9 +140,11 @@ class EmailCodeLoginApi(Resource):
email: email:
type: string type: string
description: The user's email description: The user's email
example: "test@test.edu"
code: code:
type: string type: string
description: The verification code sent to the email description: The verification code sent to the email
example: "111111"
token: token:
type: string type: string
description: The token associated with the email code login description: The token associated with the email code login
@ -208,20 +211,13 @@ class EmailCodeLoginApi(Resource):
interface_language=languages[0], interface_language=languages[0],
) )
# Assign organization if found
if organization:
OrganizationService.assign_account_to_organization(account, organization.id) OrganizationService.assign_account_to_organization(account, organization.id)
else: else:
if account.organization_id is not None and account.organization_id != organization.id: if account.current_organization_id is not None and account.current_organization_id != organization.id:
raise OrganizationMismatchError() raise OrganizationMismatchError()
# Update organization if needed
if organization:
OrganizationService.assign_account_to_organization(account, organization.id)
# Ensure account is member of tenant
connected_tenant = TenantService.get_join_tenants(account) connected_tenant = TenantService.get_join_tenants(account)
if connected_tenant is None or tenant not in connected_tenant: if connected_tenant is None or tenant not in connected_tenant:
TenantService.create_tenant_member(tenant, account, role="end_user") TenantService.create_tenant_member(tenant, account, role="end_user")

Loading…
Cancel
Save