Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
33363f0
feat: enhance VerticalDivider responsiveness and add 'Auto' option in…
iacopolea Apr 9, 2026
e282383
fix: update email verification and password handling with localized m…
iDome89 Apr 14, 2026
081e405
fix: add sign-up confirmation handling in login and signup flow
iDome89 Apr 14, 2026
8986cc2
fix: refresh auth session before updating password for Cognito users
iDome89 Apr 15, 2026
744770f
fix: update navigation logic in forgot password flow to handle profil…
iDome89 Apr 15, 2026
1163c8a
Merge pull request #1571 from AppQuality/fix-auto-generate-video-task
marcbon Apr 15, 2026
6205519
fix: update button disabling logic in PersonalInfoStep to rely on for…
iDome89 Apr 16, 2026
22343df
fix: implement change password functionality in onboarding flow
cannarocks Apr 16, 2026
2ec7636
fix: enhance form handling in PersonalInfoStep by adding onBlur and c…
iDome89 Apr 16, 2026
c574ace
fix: improve form submission handling in PersonalInfoStep by simplify…
iDome89 Apr 16, 2026
e9c4788
fix: add invitation_token to User type and update onboarding logic to…
cannarocks Apr 16, 2026
da0f75a
Merge pull request #1589 from AppQuality/fix-invited-with-pending-onb…
cannarocks Apr 17, 2026
ef5405e
Merge branch 'develop' into fix-onboarding-flow
cannarocks Apr 17, 2026
87991fc
fix: improve onboarding flow by ensuring session storage and query pa…
cannarocks Apr 17, 2026
76d3c31
fix: enhance onboarding flow by adding terms and privacy acceptance c…
iDome89 Apr 17, 2026
07395ae
fix: add terms and privacy acceptance checkboxes to InvitedUserPage a…
iDome89 Apr 17, 2026
15eba34
fix: handle errors during logout process and improve session cleanup
iDome89 Apr 17, 2026
96b2455
fix: update onboarding flow to handle redirects and improve logout pr…
cannarocks Apr 17, 2026
ed9df89
Merge pull request #1587 from AppQuality/fix-onboarding-flow
cannarocks Apr 20, 2026
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
3 changes: 3 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { defineConfig, devices } from '@playwright/test';

// Set NODE_ENV to test for test environment
process.env.NODE_ENV = 'test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
Expand Down
1 change: 1 addition & 0 deletions src/common/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,7 @@ export interface components {
*/
authType: "legacy" | "cognito";
onboarding_pending?: boolean;
invitation_token?: string;
};
/** UserPreference */
UserPreference: {
Expand Down
1 change: 1 addition & 0 deletions src/features/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3302,6 +3302,7 @@ export type User = {
unguess_wp_user_id: number;
authType: 'legacy' | 'cognito';
onboarding_pending?: boolean;
invitation_token?: string;
};
export type UserPreference = {
name: string;
Expand Down
26 changes: 26 additions & 0 deletions src/features/auth/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
resendSignUpCode,
resetPassword,
confirmResetPassword,
updatePassword,
type SignInInput,
type SignUpInput,
type ConfirmSignUpInput,
Expand All @@ -24,6 +25,7 @@ interface LoginResult {
isSignedIn: boolean;
mfaChallenge?: MfaChallengeStep;
requiresNewPassword?: boolean;
requiresSignUpConfirmation?: boolean;
}

interface ForgotPasswordResult {
Expand All @@ -38,6 +40,7 @@ interface AuthContextType {
resendSignupCode: (email: string) => Promise<void>;
confirmMfaSignIn: (code: string) => Promise<void>;
setNewPassword: (newPassword: string) => Promise<void>;
changePassword: (oldPassword: string, newPassword: string) => Promise<void>;
forgotPassword: (email: string) => Promise<ForgotPasswordResult>;
confirmForgotPassword: (
email: string,
Expand Down Expand Up @@ -87,6 +90,14 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
requiresNewPassword: true,
};
}

// Utente registrato ma non ha confermato l'email
if (nextStep.signInStep === 'CONFIRM_SIGN_UP') {
return {
isSignedIn: false,
requiresSignUpConfirmation: true,
};
}
}

await syncWordpress();
Expand Down Expand Up @@ -129,6 +140,20 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
}
};

const changePassword = async (
oldPassword: string,
newPassword: string
): Promise<void> => {
try {
await updatePassword({ oldPassword, newPassword });
await syncWordpress();
} catch (error: any) {
// eslint-disable-next-line no-console
console.error('Change password error:', error);
throw new Error(error.message || 'Failed to change password');
}
};

const signup = async (email: string, password: string, name: string) => {
try {
const signUpInput: SignUpInput = {
Expand Down Expand Up @@ -241,6 +266,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
resendSignupCode,
confirmMfaSignIn,
setNewPassword,
changePassword,
forgotPassword,
confirmForgotPassword: confirmForgotPasswordFn,
logout,
Expand Down
20 changes: 10 additions & 10 deletions src/features/auth/syncWordpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { fetchAuthSession } from 'aws-amplify/auth';
import { isDev } from 'src/common/isDevEnvironment';

export const syncWordpress = async (): Promise<void> => {
const session = await fetchAuthSession();
try {
const session = await fetchAuthSession();

const idToken = session.tokens?.idToken?.toString();
const idToken = session.tokens?.idToken?.toString();

if (!idToken) {
// eslint-disable-next-line no-console
console.error('SyncWP: No ID token available');
return;
}

if (!idToken) {
// eslint-disable-next-line no-console
console.error('SyncWP: No ID token available');
return;
}
try {
const response = await fetch(
`${process.env.REACT_APP_CROWD_WP_URL}/wp-json/cognito-sync/v1/login`,
{
Expand All @@ -23,12 +24,11 @@ export const syncWordpress = async (): Promise<void> => {
);

const result = await response.json();

if (isDev()) {
// eslint-disable-next-line no-console
console.log('🚀 ~ syncWordpress ~ result:', result);
}
} catch (error: any) {
} catch (error) {
// eslint-disable-next-line no-console
console.error('SyncWP error:', error);
}
Expand Down
22 changes: 2 additions & 20 deletions src/features/navigation/Navigation/NavigationProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import { useAppDispatch, useAppSelector } from 'src/app/hooks';
import { isDev } from 'src/common/isDevEnvironment';
import { prepareGravatar } from 'src/common/utils';
import WPAPI from 'src/common/wpapi';
import { useGetUsersMeQuery, unguessApi } from 'src/features/api';
import { useGetUsersMeQuery } from 'src/features/api';
import { useAuth } from 'src/features/auth/context';

Check warning on line 12 in src/features/navigation/Navigation/NavigationProfileModal.tsx

View workflow job for this annotation

GitHub Actions / validate

'useAuth' is defined but never used
import { useActiveWorkspace } from 'src/hooks/useActiveWorkspace';
import { setProfileModalOpen } from '../navigationSlice';
import { usePathWithoutLocale } from '../usePathWithoutLocale';
Expand All @@ -27,7 +26,6 @@
const { t, i18n } = useTranslation();
const dispatch = useAppDispatch();
const navigate = useNavigate();
const { logout: cognitoLogout } = useAuth();

const pathWithoutLocale = usePathWithoutLocale();

Expand Down Expand Up @@ -102,23 +100,7 @@
}
},
onLogout: async () => {
// TODO: rimuovere wp dopo migration completa
try {
// Se l'utente è autenticato con Cognito, esegui logout Cognito
if (user?.authType === 'cognito') {
await cognitoLogout();
}

// Logout legacy WP per utenti con cookie
await WPAPI.logout();

// Reset rtk query cache
dispatch(unguessApi.util.resetApiState());
} catch (err) {
// eslint-disable-next-line no-console
console.error('logout error:', err);
document.location.href = '/login';
}
navigate('/logout');
},
onCopyEmail: () => {
addToast(
Expand Down
5 changes: 4 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1631,10 +1631,13 @@
"CONFIRM_EMAIL_DESCRIPTION": "We sent an email with your code to:",
"CONFIRM_EMAIL_DIDNT_RECEIVE": "Didn't receive a code?",
"CONFIRM_EMAIL_ERROR_GENERIC": "Something went wrong. Please try again.",
"CONFIRM_EMAIL_TITLE": "Verify your email",
"CONFIRM_EMAIL_TITLE": "All set! Just verify your email to begin",
"CONFIRM_PASSWORD_LABEL": "Confirm password",
"CONFIRM_PASSWORD_MUST_MATCH": "Passwords must match",
"CONFIRM_PASSWORD_PLACEHOLDER": "Confirm your password",
"CONFIRM_PASSWORD_REQUIRED": "Please confirm your password",
"FORGOT_PASSWORD_BACK_TO_LOGIN": "Back to log in",
"FORGOT_PASSWORD_BACK_TO_PROFILE": "Back to profile",
"FORGOT_PASSWORD_CHANGE_SUBTITLE": "Enter a new password for your account",
"FORGOT_PASSWORD_CHANGE_TITLE": "Change your password",
"FORGOT_PASSWORD_CHECK_EMAIL_SUBTITLE": "We sent a password reset link to <bold>{{email}}</bold>.",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1676,8 +1676,11 @@
"CONFIRM_EMAIL_ERROR_GENERIC": "",
"CONFIRM_EMAIL_TITLE": "",
"CONFIRM_PASSWORD_LABEL": "",
"CONFIRM_PASSWORD_MUST_MATCH": "",
"CONFIRM_PASSWORD_PLACEHOLDER": "",
"CONFIRM_PASSWORD_REQUIRED": "",
"FORGOT_PASSWORD_BACK_TO_LOGIN": "",
"FORGOT_PASSWORD_BACK_TO_PROFILE": "",
"FORGOT_PASSWORD_CHANGE_SUBTITLE": "",
"FORGOT_PASSWORD_CHANGE_TITLE": "",
"FORGOT_PASSWORD_CHECK_EMAIL_SUBTITLE": "",
Expand Down
34 changes: 32 additions & 2 deletions src/pages/Auth/logout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAppDispatch } from 'src/app/hooks';
import { PageLoader } from 'src/common/components/PageLoader';
import { unguessApi, useGetUsersMeQuery } from 'src/features/api';
import { useAuth } from 'src/features/auth/context';

export const LogoutPage = () => {
const navigate = useNavigate();
const { data: user } = useGetUsersMeQuery();
const { logout: cognitoLogout } = useAuth();
const dispatch = useAppDispatch();

useEffect(() => {
navigate('/login');
}, [navigate]);
const performLogout = async () => {
try {
if (user?.authType === 'cognito') {
await cognitoLogout();
}
} catch (err) {
// eslint-disable-next-line no-console
console.error('Cognito logout error:', err);
}

try {
await fetch(
`${process.env.REACT_APP_CROWD_WP_URL}/wp-admin/admin-ajax.php?action=unguess_wp_logout`,
{ method: 'GET', credentials: 'include' }
);
} catch (err) {
// eslint-disable-next-line no-console
console.error('WP logout error:', err);
}

dispatch(unguessApi.util.resetApiState());
navigate('/login');
};

performLogout();
}, [navigate, dispatch, user, cognitoLogout]);

return <PageLoader />;
};
13 changes: 11 additions & 2 deletions src/pages/ForgotPasswordPage/CheckEmailStep.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router-dom';
import { Anchor, MD, Span, Title, XL } from '@appquality/unguess-design-system';
import { appTheme } from 'src/app/theme';
import { useLocalizeRoute } from 'src/hooks/useLocalizedRoute';
Expand All @@ -14,7 +15,10 @@ interface CheckEmailStepProps {

export const CheckEmailStep = ({ email, onResend }: CheckEmailStepProps) => {
const { t } = useTranslation();
const [searchParams] = useSearchParams();
const isFromProfile = searchParams.get('from') === 'profile';
const loginRoute = useLocalizeRoute('login');
const profileRoute = useLocalizeRoute('profile');
const [resendTimer, setResendTimer] = useState(0);
const [isResending, setIsResending] = useState(false);

Expand Down Expand Up @@ -103,8 +107,13 @@ export const CheckEmailStep = ({ email, onResend }: CheckEmailStepProps) => {
</MD>

<div style={{ textAlign: 'center', marginTop: appTheme.space.lg }}>
<Anchor href={loginRoute} style={{ color: appTheme.palette.blue[600] }}>
{t('FORGOT_PASSWORD_BACK_TO_LOGIN')}
<Anchor
href={isFromProfile ? profileRoute : loginRoute}
style={{ color: appTheme.palette.blue[600] }}
>
{isFromProfile
? t('FORGOT_PASSWORD_BACK_TO_PROFILE')
: t('FORGOT_PASSWORD_BACK_TO_LOGIN')}
</Anchor>
</div>
</>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/ForgotPasswordPage/ForgotPasswordForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router-dom';
import {
Button,
FormField,
Expand All @@ -26,7 +27,10 @@ interface ForgotPasswordFormProps {

export const ForgotPasswordForm = ({ onSubmit }: ForgotPasswordFormProps) => {
const { t } = useTranslation();
const [searchParams] = useSearchParams();
const isFromProfile = searchParams.get('from') === 'profile';
const loginRoute = useLocalizeRoute('login');
const profileRoute = useLocalizeRoute('profile');
const [email, setEmail] = useState('');
const [error, setError] = useState<string | null>(null);
const [isSubmitting, setIsSubmitting] = useState(false);
Expand Down Expand Up @@ -106,13 +110,15 @@ export const ForgotPasswordForm = ({ onSubmit }: ForgotPasswordFormProps) => {
<Button
type="button"
onClick={() => {
window.location.href = loginRoute;
window.location.href = isFromProfile ? profileRoute : loginRoute;
}}
isBasic
isStretched
style={{ marginTop: appTheme.space.xs }}
>
{t('FORGOT_PASSWORD_BACK_TO_LOGIN')}
{isFromProfile
? t('FORGOT_PASSWORD_BACK_TO_PROFILE')
: t('FORGOT_PASSWORD_BACK_TO_LOGIN')}
</Button>
</StyledForm>
</>
Expand Down
Loading
Loading