Compare commits

...

2 Commits

Author SHA1 Message Date
Vishal Sharma
8096dbc7af Merge branch 'develop' into fix/precheck-login 2023-12-13 16:21:51 +05:30
makeavish
6900b2a998 fix: return isUser false in case precheck login is not able to create user when sso is enabled 2023-11-27 19:40:44 +05:30
2 changed files with 4 additions and 3 deletions

View File

@@ -185,6 +185,7 @@ func (ah *APIHandler) precheckLogin(w http.ResponseWriter, r *http.Request) {
resp, apierr := ah.AppDao().PrecheckLogin(ctx, email, sourceUrl)
if apierr != nil {
RespondError(w, apierr, resp)
return
}
ah.Respond(w, resp)

View File

@@ -150,8 +150,6 @@ func (m *modelDao) PrecheckLogin(ctx context.Context, email, sourceUrl string) (
if ssoAvailable {
resp.IsUser = true
// find domain from email
orgDomain, apierr := m.GetDomainByEmail(ctx, email)
if apierr != nil {
@@ -180,7 +178,7 @@ func (m *modelDao) PrecheckLogin(ctx context.Context, email, sourceUrl string) (
return resp, model.InternalError(fmt.Errorf("failed to generate login request"))
}
// build Idp URL that will authenticat the user
// build Idp URL that will authenticate the user
// the front-end will redirect user to this url
resp.SsoUrl, err = orgDomain.BuildSsoUrl(siteUrl)
@@ -189,6 +187,8 @@ func (m *modelDao) PrecheckLogin(ctx context.Context, email, sourceUrl string) (
return resp, model.InternalError(err)
}
// set IsUser to true, as the user is valid
resp.IsUser = true
// set SSO to true, as the url is generated correctly
resp.SSO = true
}