(Breaking change) Switch between set password and change password on the settings page. (#15582)

Here is what the PR does:

- Surface password state in validatePasswordResetToken, returning
hasPassword so the client can tell whether a user is setting or changing
their password.
- Consume that flag throughout the front end (mock data, stories,
GraphQL types) and update the Reset/Set Password modal to swap the
heading/button label and success toast accordingly.
- After a successful password set/reset, immediately update the
logged-in user’s hasPassword flag so the Settings screen reflects the
new state without a reload.

Modal has two states now - reset password modal uses change password
state since it made intuitive sense.

<p align="center">
<img width="404" height="397" alt="image"
src="https://github.com/user-attachments/assets/c54cc581-1248-4395-833d-0202758e1947"
/>
</p>

<p align="center">
<img width="403" height="393" alt="image"
src="https://github.com/user-attachments/assets/d8a39a95-27e6-4037-86f2-1f74176002ba"
/>
</p>

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
Abdullah.
2025-11-05 15:29:37 +05:00
committed by GitHub
parent cc7343a8f2
commit 0fcfcec426
80 changed files with 756 additions and 358 deletions
@@ -9,20 +9,26 @@ import { type APP_LOCALES } from 'twenty-shared/translations';
type PasswordResetLinkEmailProps = {
duration: string;
hasPassword: boolean;
link: string;
locale: keyof typeof APP_LOCALES;
};
export const PasswordResetLinkEmail = ({
duration,
hasPassword,
link,
locale,
}: PasswordResetLinkEmailProps) => {
const i18n = createI18nInstance(locale);
const headline = hasPassword
? i18n._('Reset your password 🗝')
: i18n._('Set your password 🗝');
const ctaLabel = hasPassword ? i18n._('Reset') : i18n._('Set');
return (
<BaseEmail locale={locale}>
<Title value={i18n._('Reset your password 🗝')} />
<Title value={headline} />
<MainText>
<Trans
id="This link is only valid for the next {duration}. If the link does not work, you can use the login verification link directly:"
@@ -32,7 +38,7 @@ export const PasswordResetLinkEmail = ({
<Link href={link} value={link} />
</MainText>
<br />
<CallToAction href={link} value={i18n._('Reset')} />
<CallToAction href={link} value={ctaLabel} />
<br />
<br />
</BaseEmail>
@@ -41,6 +47,7 @@ export const PasswordResetLinkEmail = ({
PasswordResetLinkEmail.PreviewProps = {
duration: '24 hours',
hasPassword: true,
link: 'https://app.twenty.com/reset-password/123',
locale: 'en',
} as PasswordResetLinkEmailProps;