Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 0 additions & 29 deletions src/common/components/LegacyAuthBanner/index.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions src/common/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,6 @@ export interface paths {
};
};
};
"/users/me/token": {
get: operations["get-users-me-token"];
};
"/ai/jobs": {
post: operations["post-ai-jobs"];
};
Expand Down Expand Up @@ -5348,20 +5345,6 @@ export interface operations {
500: components["responses"]["Error"];
};
};
"get-users-me-token": {
responses: {
/** OK */
200: {
content: {
"application/json": {
token: string;
};
};
};
400: components["responses"]["Error"];
403: components["responses"]["Error"];
};
};
"post-ai-jobs": {
responses: {
/** OK */
Expand Down
11 changes: 0 additions & 11 deletions src/features/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,12 +1025,6 @@ const injectedRtkApi = api.injectEndpoints({
method: 'DELETE',
}),
}),
getUsersMeToken: build.query<
GetUsersMeTokenApiResponse,
GetUsersMeTokenApiArg
>({
query: () => ({ url: `/users/me/token` }),
}),
postAiJobs: build.mutation<PostAiJobsApiResponse, PostAiJobsApiArg>({
query: (queryArg) => ({
url: `/ai/jobs`,
Expand Down Expand Up @@ -2517,10 +2511,6 @@ export type DeleteCampaignsByCidWatchersAndProfileIdApiArg = {
profileId: string;
cid: string;
};
export type GetUsersMeTokenApiResponse = /** status 200 OK */ {
token: string;
};
export type GetUsersMeTokenApiArg = void;
export type PostAiJobsApiResponse = /** status 200 OK */ {
original_input: string;
output: string;
Expand Down Expand Up @@ -3544,6 +3534,5 @@ export const {
usePostWorkspacesByWidUsersMutation,
useDeletePlansByPidWatchersAndProfileIdMutation,
useDeleteCampaignsByCidWatchersAndProfileIdMutation,
useGetUsersMeTokenQuery,
usePostAiJobsMutation,
} = injectedRtkApi;
35 changes: 4 additions & 31 deletions src/features/navigation/Navigation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { Content } from '@appquality/unguess-design-system';
import {
ComponentProps,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { ComponentProps, useEffect, useMemo } from 'react';
import { useParams } from 'react-router-dom';
import { useAppDispatch } from 'src/app/hooks';
import { appTheme } from 'src/app/theme';
import { LegacyAuthBanner } from 'src/common/components/LegacyAuthBanner';
import { AppSidebar } from 'src/common/components/navigation/sidebar';
import {
setSidebarOpen,
Expand All @@ -26,14 +18,13 @@ import { NavigationProfileModal } from './NavigationProfileModal';
const StyledContent = styled(Content)<
ComponentProps<typeof Content> & {
$isMinimal?: boolean;
$bannerHeight?: number;
children?: React.ReactNode;
}
>`
height: ${({ $isMinimal, $bannerHeight = 0, theme }) =>
height: ${({ $isMinimal, theme }) =>
$isMinimal
? '100%'
: `calc(100% - ${theme.components.chrome.header.height} - ${$bannerHeight}px)`};
: `calc(100% - ${theme.components.chrome.header.height})`};
`;

export const Navigation = ({
Expand Down Expand Up @@ -93,31 +84,13 @@ export const Navigation = ({
dispatch(toggleSidebar());
};

const [bannerHeight, setBannerHeight] = useState(0);
const bannerObserverRef = useRef<ResizeObserver | null>(null);
const bannerRefCallback = useCallback((node: HTMLDivElement | null) => {
bannerObserverRef.current?.disconnect();
if (!node) {
bannerObserverRef.current = null;
setBannerHeight(0);
return;
}
setBannerHeight(node.getBoundingClientRect().height);
const observer = new ResizeObserver((entries) => {
setBannerHeight(entries[0].contentRect.height);
});
observer.observe(node);
bannerObserverRef.current = observer;
}, []);

if (!activeWorkspace && !isLoading) return <NoActiveWorkSpaceState />;

return (
<>
<NavigationHeader isMinimal={isMinimal} />
<NavigationProfileModal />
{!isMinimal && <LegacyAuthBanner ref={bannerRefCallback} />}
<StyledContent $isMinimal={isMinimal} $bannerHeight={bannerHeight}>
<StyledContent $isMinimal={isMinimal}>
<AppSidebar
route={
route === 'projects' && parameter !== ''
Expand Down
6 changes: 3 additions & 3 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,14 @@
"__LOGIN_FORM_EMAIL_LABEL": "Work Email",
"__LOGIN_FORM_EMAIL_PLACEHOLDER": "name@company.com",
"__LOGIN_FORM_FAILED_INVALID": "Wrong username or password.",
"__LOGIN_FORM_INVALID_CREDENTIALS_ALERT_MESSAGE": "To enter, you might need to reset your password. If you haven't updated it yet, click <forgotLink>Forgot password?</forgotLink>. Otherwise, please try again.",
"__LOGIN_FORM_INVALID_CREDENTIALS_ALERT_TITLE": "Trouble logging in?",
"__LOGIN_FORM_INVALID_CREDENTIALS_TOAST": "<bold>Invalid credentials.</bold> Please try again or update your password",
"__LOGIN_FORM_NO_ACCOUNT_LABEL": "Don't have an account?",
"__LOGIN_FORM_PASSWORD_FORGOT_LABEL": "Forgot password?",
"__LOGIN_FORM_PASSWORD_LABEL": "Password",
"__LOGIN_FORM_PASSWORD_PLACEHOLDER": "Enter password",
"__LOGIN_FORM_SIGNUP_CTA": "Sign up",
"__LOGIN_FORM_SSO_INFO_MESSAGE": "To comply with new security protocols, please update your password by <strong>May 12, 2026</strong>.",
"__LOGIN_FORM_SSO_INFO_TITLE": "Update your password for data security",
"__LOGIN_FORM_SUBTITLE": "Log in to your UNGUESS account",
"__LOGIN_FORM_TITLE": "Welcome back!",
"__LOGIN_SESSION_EXPIRED_MESSAGE": "Your session has expired. Please log in again.",
Expand Down Expand Up @@ -1398,7 +1399,6 @@
"__PROFILE_PAGE_SECURITY_CARD_LABEL": "Security settings",
"__PROFILE_PAGE_SECURITY_CONTACT_SUPPORT": "Contact support",
"__PROFILE_PAGE_SECURITY_LEGACY_ALERT_MESSAGE": "To upgrade your account protection, please change your password by May 12, 2026. Note that your new password cannot match the current one. This update is a mandatory prerequisite for enabling two-factor authentication.",
"__PROFILE_PAGE_SECURITY_LEGACY_ALERT_TITLE": "Security update: change your password",
"__PROFILE_PAGE_SECURITY_NEED_HELP": "Need help?",
"__PROFILE_PAGE_SURNAME_REQUIRED_ERROR": "Surname is required",
"__PROFILE_PAGE_TITLE": "My Profile",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -737,13 +737,14 @@
"__LOGIN_FORM_EMAIL_LABEL": "Email di lavoro",
"__LOGIN_FORM_EMAIL_PLACEHOLDER": "nome@azienda.com",
"__LOGIN_FORM_FAILED_INVALID": "L'indirizzo email o la password non sono corretti.",
"__LOGIN_FORM_INVALID_CREDENTIALS_ALERT_MESSAGE": "",
"__LOGIN_FORM_INVALID_CREDENTIALS_ALERT_TITLE": "",
"__LOGIN_FORM_INVALID_CREDENTIALS_TOAST": "",
"__LOGIN_FORM_NO_ACCOUNT_LABEL": "Non hai un account?",
"__LOGIN_FORM_PASSWORD_FORGOT_LABEL": "Password dimenticata?",
"__LOGIN_FORM_PASSWORD_LABEL": "Password",
"__LOGIN_FORM_PASSWORD_PLACEHOLDER": "Inserisci password",
"__LOGIN_FORM_SIGNUP_CTA": "Registrati",
"__LOGIN_FORM_SSO_INFO_MESSAGE": "",
"__LOGIN_FORM_SSO_INFO_TITLE": "",
"__LOGIN_FORM_SUBTITLE": "Accedi al tuo account UNGUESS",
"__LOGIN_FORM_TITLE": "Bentornato!",
"__LOGIN_SESSION_EXPIRED_MESSAGE": "La sessione è scaduta. Effettua nuovamente il login.",
Expand Down Expand Up @@ -1432,7 +1433,6 @@
"__PROFILE_PAGE_SECURITY_CARD_LABEL": "Impostazioni di sicurezza",
"__PROFILE_PAGE_SECURITY_CONTACT_SUPPORT": "Contatta il supporto",
"__PROFILE_PAGE_SECURITY_LEGACY_ALERT_MESSAGE": "To protect your work, please update your password by [Date]. This update is required to enable two-factor authentication or to switch to Single Sign-On by contacting your CSM.",
"__PROFILE_PAGE_SECURITY_LEGACY_ALERT_TITLE": "Update your security settings",
"__PROFILE_PAGE_SECURITY_NEED_HELP": "Hai bisogno di aiuto?",
"__PROFILE_PAGE_SURNAME_REQUIRED_ERROR": "",
"__PROFILE_PAGE_TITLE": "Profilo",
Expand Down
7 changes: 1 addition & 6 deletions src/pages/JoinPage/SignupPage/SignupForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
validationSchema={getSignupValidationSchema(t)}
onSubmit={handleSubmit}
>
{({ isSubmitting, isValid, values }) => (

Check warning on line 143 in src/pages/JoinPage/SignupPage/SignupForm.tsx

View workflow job for this annotation

GitHub Actions / validate

'isValid' is defined but never used
<Form>
<FieldContainer>
<Field name="email" validate={validateEmail}>
Expand Down Expand Up @@ -313,12 +313,7 @@
isPrimary
isAccent
isStretched
disabled={
isSubmitting ||
!isValid ||
!values.termsAccepted ||
!values.privacyAccepted
}
disabled={isSubmitting}
style={{ marginTop: appTheme.space.sm }}
>
{isSubmitting ? t('LOADING') : t('SIGNUP_FORM_SUBMIT')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/JoinPage/SignupPage/validationSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getSignupValidationSchema = (t: TFunction) =>
'mac.com',
'aol.com',
'protonmail.com',
'Proton: Privacy by default',
'proton.me',
'gmx.com',
'gmx.net',
'mail.com',
Expand Down
47 changes: 25 additions & 22 deletions src/pages/LoginPage/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
MD,
MediaInput,
Message,
Span,
Title,
XL,
} from '@appquality/unguess-design-system';
import { ReactComponent as EyeIcon } from '@zendeskgarden/svg-icons/src/16/eye-fill.svg';
import { ReactComponent as EyeOffIcon } from '@zendeskgarden/svg-icons/src/16/eye-hide-fill.svg';
import { appTheme } from 'src/app/theme';
import { useLocalizeRoute } from 'src/hooks/useLocalizedRoute';
import { LoginFormFields } from './type';

const StyledCard = styled(ContainerCard)`
Expand Down Expand Up @@ -58,6 +58,7 @@ interface LoginFormProps {
const LoginForm = ({ onSubmit, buttonText }: LoginFormProps) => {
const { t } = useTranslation();
const [showPassword, setShowPassword] = useState(false);
const forgotPasswordRoute = useLocalizeRoute('forgot-password');

const validate = (values: LoginFormFields) => {
const errors: Partial<Record<keyof LoginFormFields, string>> = {};
Expand Down Expand Up @@ -167,7 +168,7 @@ const LoginForm = ({ onSubmit, buttonText }: LoginFormProps) => {
)}
</FormField>
<Anchor
href="/forgot-password"
href={forgotPasswordRoute}
style={{
color: appTheme.palette.blue[600],
marginTop: appTheme.space.xs,
Expand All @@ -177,15 +178,31 @@ const LoginForm = ({ onSubmit, buttonText }: LoginFormProps) => {
>
{t('__LOGIN_FORM_PASSWORD_FORGOT_LABEL')}
</Anchor>
{status?.type === 'invalid' && (
<Alert
type="warning"
style={{ marginBottom: appTheme.space.lg }}
>
<Alert.Title>
{t('__LOGIN_FORM_INVALID_CREDENTIALS_ALERT_TITLE')}
</Alert.Title>
<Trans
i18nKey="__LOGIN_FORM_INVALID_CREDENTIALS_ALERT_MESSAGE"
components={{
forgotLink: (
<Anchor
href={forgotPasswordRoute}
style={{ color: appTheme.palette.blue[600] }}
/>
),
}}
/>
</Alert>
)}
<Button
type="submit"
isStretched
disabled={
Object.keys(errors).length > 0 ||
isSubmitting ||
!values.email ||
!values.password
}
disabled={isSubmitting}
isPrimary
isAccent
style={{ marginBottom: appTheme.space.md }}
Expand All @@ -204,20 +221,6 @@ const LoginForm = ({ onSubmit, buttonText }: LoginFormProps) => {
{t('__LOGIN_FORM_SIGNUP_CTA')}
</Anchor>
</MD>
{status && (
<div style={{ textAlign: 'center' }}>
<Message validation="error">{status.message}</Message>
</div>
)}
{new Date() <= new Date('2026-05-12') && (
<Alert type="info" style={{ marginTop: appTheme.space.xl }}>
<Alert.Title>{t('__LOGIN_FORM_SSO_INFO_TITLE')}</Alert.Title>
<Trans
i18nKey="__LOGIN_FORM_SSO_INFO_MESSAGE"
components={{ strong: <Span isBold /> }}
/>
</Alert>
)}
</StyledForm>
)}
</Formik>
Expand Down
36 changes: 33 additions & 3 deletions src/pages/LoginPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {
Logo,
Notification,
Span,
useToast,
} from '@appquality/unguess-design-system';
import { FormikHelpers } from 'formik';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import WPAPI from 'src/common/wpapi';
import { useGetUsersMeQuery } from 'src/features/api';
Expand Down Expand Up @@ -95,6 +96,28 @@ const LoginPage = () => {
);
};

const showInvalidCredentialsToast = () => {
addToast(
({ close }) => (
<Notification
onClose={close}
type="error"
message={
(
<Trans
i18nKey="__LOGIN_FORM_INVALID_CREDENTIALS_TOAST"
components={{ bold: <Span isBold /> }}
/>
) as unknown as string
}
closeText={t('__TOAST_CLOSE_TEXT')}
isPrimary
/>
),
{ placement: 'top' }
);
};

const loginUser = async (
values: LoginFormFields,
{ setSubmitting, setStatus }: FormikHelpers<LoginFormFields>
Expand Down Expand Up @@ -141,7 +164,11 @@ const LoginPage = () => {
nonce = await WPAPI.getNonce();
} catch (err: any) {
if (err?.status !== 200) {
showGenericErrorToast('Get Nonce: ');
showInvalidCredentialsToast();
setStatus({
message: t('__LOGIN_FORM_FAILED_INVALID'),
type: 'invalid',
});
setSubmitting(false);
return;
}
Expand All @@ -165,7 +192,10 @@ const LoginPage = () => {
const error = JSON.parse(message);

if (error.type === 'invalid') {
setStatus({ message: `${t('__LOGIN_FORM_FAILED_INVALID')}` });
setStatus({
message: t('__LOGIN_FORM_FAILED_INVALID'),
type: 'invalid',
});
} else {
showGenericErrorToast();
}
Expand Down
Loading
Loading