This commit is contained in:
2026-07-12 12:20:23 +08:00
parent 7f2d5579ff
commit f923791d39
252 changed files with 9872 additions and 647 deletions
@@ -33,14 +33,6 @@ export const validateRouteAccess = (to, next, chatwootConfig = {}) => {
return;
}
// If the URL is an invalid path, redirect to login page
// Disable navigation to signup page if signups are disabled
// Signup route has an attribute (requireSignupEnabled) in it's definition
const isAnInalidSignupNavigation =
chatwootConfig.signupEnabled !== 'true' &&
to.meta &&
to.meta.requireSignupEnabled;
// Disable navigation to SAML login if enterprise is not enabled
// SAML route has an attribute (requireEnterprise) in it's definition
const isEnterpriseOnlyPath =
@@ -48,7 +40,7 @@ export const validateRouteAccess = (to, next, chatwootConfig = {}) => {
to.meta &&
to.meta.requireEnterprise;
if (!to.name || isAnInalidSignupNavigation || isEnterpriseOnlyPath) {
if (!to.name || isEnterpriseOnlyPath) {
next(frontendURL('login'));
return;
}
@@ -57,14 +57,6 @@ describe('#validateRouteAccess', () => {
expect(next).toHaveBeenCalledWith('/app/login');
});
it('redirects to login if signup is disabled', () => {
validateRouteAccess({ meta: { requireSignupEnabled: true } }, next, {
signupEnabled: 'true',
});
expect(clearBrowserSessionCookies).not.toHaveBeenCalled();
expect(next).toHaveBeenCalledWith('/app/login');
});
it('continues to the route in every other case', () => {
validateRouteAccess({ name: 'reset_password' }, next);
expect(clearBrowserSessionCookies).not.toHaveBeenCalled();