fix: Allow users to login even if they have access to more than 15 accounts (#4475)
This commit is contained in:
parent
80e5d6d7a0
commit
0319b78eac
19 changed files with 368 additions and 350 deletions
|
@ -14,6 +14,9 @@ export const getLoginRedirectURL = (ssoAccountId, user) => {
|
|||
if (ssoAccount) {
|
||||
return frontendURL(`accounts/${ssoAccountId}/dashboard`);
|
||||
}
|
||||
if (accounts.length) {
|
||||
return frontendURL(`accounts/${accounts[0].id}/dashboard`);
|
||||
}
|
||||
return DEFAULT_REDIRECT_URL;
|
||||
};
|
||||
|
||||
|
@ -41,15 +44,6 @@ export const conversationUrl = ({
|
|||
return url;
|
||||
};
|
||||
|
||||
export const accountIdFromPathname = pathname => {
|
||||
const isInsideAccountScopedURLs = pathname.includes('/app/accounts');
|
||||
const urlParam = pathname.split('/')[3];
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
const isScoped = isInsideAccountScopedURLs && !isNaN(urlParam);
|
||||
const accountId = isScoped ? Number(urlParam) : '';
|
||||
return accountId;
|
||||
};
|
||||
|
||||
export const isValidURL = value => {
|
||||
/* eslint-disable no-useless-escape */
|
||||
const URL_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue