Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions controlplane/src/core/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,18 @@ const plugin: FastifyPluginCallback<AuthControllerOptions> = function Auth(fasti
// Set the sso cookie.
opts.authUtils.createSsoCookie(res, ssoSlug);
}
if (redirectURL) {
if (redirectURL.startsWith(opts.webBaseUrl)) {
res.redirect(redirectURL);
} else {
res.redirect(opts.webBaseUrl);
}
} else if (orgs === 0) {
res.redirect(opts.webBaseUrl + '?migrate=true');
// Determine the target URL
let targetUrl = opts.webBaseUrl;
if (redirectURL && redirectURL.startsWith(opts.webBaseUrl)) {
targetUrl = redirectURL;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// Append onboarding parameter if the user has no orgs
if (orgs === 0) {
const separator = targetUrl.includes('?') ? '&' : '?';
res.redirect(targetUrl + separator + 'onboarding=true');
Comment thread
JivusAyrus marked this conversation as resolved.
Dismissed
} else {
res.redirect(opts.webBaseUrl);
res.redirect(targetUrl);
Comment thread
JivusAyrus marked this conversation as resolved.
}
} catch (err: any) {
if (err instanceof AuthenticationError) {
Expand Down
Loading