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
+1 -21
View File
@@ -5,10 +5,7 @@ import {
parseAPIErrorResponse,
} from 'dashboard/store/utils/api';
import wootAPI from './apiClient';
import {
getLoginRedirectURL,
getCredentialsFromEmail,
} from '../helpers/AuthHelper';
import { getLoginRedirectURL } from '../helpers/AuthHelper';
export const login = async ({
ssoAccountId,
@@ -49,23 +46,6 @@ export const login = async ({
}
};
export const register = async creds => {
try {
const { fullName, accountName } = getCredentialsFromEmail(creds.email);
const response = await wootAPI.post('api/v1/accounts.json', {
account_name: accountName,
user_full_name: fullName,
email: creds.email,
password: creds.password,
h_captcha_client_response: creds.hCaptchaClientResponse,
});
return response.data;
} catch (error) {
throwErrorMessage(error);
}
return null;
};
export const resendConfirmation = async ({ email, hCaptchaClientResponse }) => {
return wootAPI.post('resend_confirmation', {
email,
@@ -95,7 +95,7 @@ const currentInputType = computed(() => {
sm
link
:icon="isPasswordVisible ? 'i-lucide-eye-off' : 'i-lucide-eye'"
class="absolute inset-y-0 right-0 pr-3"
class="absolute top-0 right-0 h-10 pr-3"
:aria-label="isPasswordVisible ? 'Hide password' : 'Show password'"
:aria-pressed="isPasswordVisible"
@click="togglePasswordVisibility()"
@@ -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();
@@ -94,9 +94,6 @@ export default {
Boolean(window.chatwootConfig.googleOAuthClientId)
);
},
showSignupLink() {
return window.chatwootConfig.signupEnabled === 'true';
},
showSamlLogin() {
return this.allowedLoginMethods.includes('saml');
},
@@ -233,26 +230,9 @@ export default {
class="flex flex-col w-full min-h-screen py-20 bg-n-brand/5 dark:bg-n-background sm:px-6 lg:px-8"
>
<section class="max-w-5xl mx-auto">
<img
:src="globalConfig.logo"
:alt="globalConfig.installationName"
class="block w-auto h-8 mx-auto dark:hidden"
/>
<img
v-if="globalConfig.logoDark"
:src="globalConfig.logoDark"
:alt="globalConfig.installationName"
class="hidden w-auto h-8 mx-auto dark:block"
/>
<h2 class="mt-6 text-3xl font-medium text-center text-n-slate-12">
<h2 class="text-3xl font-medium text-center text-n-slate-12">
{{ replaceInstallationName($t('LOGIN.TITLE')) }}
</h2>
<p v-if="showSignupLink" class="mt-3 text-sm text-center text-n-slate-11">
{{ $t('COMMON.OR') }}
<router-link to="auth/signup" class="lowercase text-link text-n-brand">
{{ $t('LOGIN.CREATE_NEW_ACCOUNT') }}
</router-link>
</p>
</section>
<!-- MFA Verification Section -->
@@ -2,7 +2,6 @@ import { frontendURL } from 'dashboard/helper/URLHelper';
import Login from './login/Index.vue';
import SamlLogin from './login/Saml.vue';
import Signup from './auth/signup/Index.vue';
import ResetPassword from './auth/reset/password/Index.vue';
import Confirmation from './auth/confirmation/Index.vue';
import VerifyEmail from './auth/verify-email/Index.vue';
@@ -32,12 +31,6 @@ export default [
target: route.query.target,
}),
},
{
path: frontendURL('auth/signup'),
name: 'auth_signup',
component: Signup,
meta: { requireSignupEnabled: true },
},
{
path: frontendURL('auth/confirmation'),
name: 'auth_confirmation',