Update "Password Reset" to "Update Password"
The code changes correspond to the rebranding of "Password Reset" to "Update Password". The names of components, functions, and routes have been updated to reflect this change. Also, a minor code optimization has been made in the i18n.server file for the creation of i18n server instances.
This commit is contained in:
@@ -17,9 +17,10 @@ export const generateMetadata = async () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function PasswordResetPage() {
|
const { callback, passwordUpdate, signIn } = pathsConfig.auth;
|
||||||
const redirectPath = `${pathsConfig.auth.callback}?next=${pathsConfig.auth.passwordUpdate}`;
|
const redirectPath = `${callback}?next=${passwordUpdate}`;
|
||||||
|
|
||||||
|
function PasswordResetPage() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Heading level={4}>
|
<Heading level={4}>
|
||||||
@@ -30,7 +31,7 @@ function PasswordResetPage() {
|
|||||||
<PasswordResetRequestContainer redirectPath={redirectPath} />
|
<PasswordResetRequestContainer redirectPath={redirectPath} />
|
||||||
|
|
||||||
<div className={'flex justify-center text-xs'}>
|
<div className={'flex justify-center text-xs'}>
|
||||||
<Link href={pathsConfig.auth.signIn}>
|
<Link href={signIn}>
|
||||||
<Button variant={'link'} size={'sm'}>
|
<Button variant={'link'} size={'sm'}>
|
||||||
<Trans i18nKey={'auth:passwordRecoveredQuestion'} />
|
<Trans i18nKey={'auth:passwordRecoveredQuestion'} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { redirect } from 'next/navigation';
|
import { redirect } from 'next/navigation';
|
||||||
|
|
||||||
import { PasswordResetForm } from '@kit/auth/password-reset';
|
import { UpdatePasswordForm } from '@kit/auth/password-reset';
|
||||||
import { AuthLayoutShell } from '@kit/auth/shared';
|
import { AuthLayoutShell } from '@kit/auth/shared';
|
||||||
import { requireUser } from '@kit/supabase/require-user';
|
import { requireUser } from '@kit/supabase/require-user';
|
||||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||||
@@ -18,7 +18,7 @@ export const generateMetadata = async () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
async function PasswordResetPage() {
|
async function UpdatePasswordPage() {
|
||||||
const client = getSupabaseServerComponentClient();
|
const client = getSupabaseServerComponentClient();
|
||||||
const auth = await requireUser(client);
|
const auth = await requireUser(client);
|
||||||
|
|
||||||
@@ -29,9 +29,9 @@ async function PasswordResetPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthLayoutShell Logo={AppLogo}>
|
<AuthLayoutShell Logo={AppLogo}>
|
||||||
<PasswordResetForm redirectTo={pathsConfig.app.home} />
|
<UpdatePasswordForm redirectTo={pathsConfig.app.home} />
|
||||||
</AuthLayoutShell>
|
</AuthLayoutShell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withI18n(PasswordResetPage);
|
export default withI18n(UpdatePasswordPage);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { cache } from 'react';
|
||||||
|
|
||||||
import { cookies, headers } from 'next/headers';
|
import { cookies, headers } from 'next/headers';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -21,7 +23,7 @@ import { i18nResolver } from './i18n.resolver';
|
|||||||
*
|
*
|
||||||
* Initialize the i18n instance for every RSC server request (eg. each page/layout)
|
* Initialize the i18n instance for every RSC server request (eg. each page/layout)
|
||||||
*/
|
*/
|
||||||
export function createI18nServerInstance() {
|
function createInstance() {
|
||||||
const acceptLanguage = headers().get('accept-language');
|
const acceptLanguage = headers().get('accept-language');
|
||||||
const cookie = cookies().get(I18N_COOKIE_NAME)?.value;
|
const cookie = cookies().get(I18N_COOKIE_NAME)?.value;
|
||||||
|
|
||||||
@@ -42,3 +44,5 @@ export function createI18nServerInstance() {
|
|||||||
|
|
||||||
return initializeServerI18n(settings, i18nResolver);
|
return initializeServerI18n(settings, i18nResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const createI18nServerInstance = cache(createInstance);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { Trans } from '@kit/ui/trans';
|
|||||||
|
|
||||||
import { PasswordResetSchema } from '../schemas/password-reset.schema';
|
import { PasswordResetSchema } from '../schemas/password-reset.schema';
|
||||||
|
|
||||||
export function PasswordResetForm(params: { redirectTo: string }) {
|
export function UpdatePasswordForm(params: { redirectTo: string }) {
|
||||||
const updateUser = useUpdateUser();
|
const updateUser = useUpdateUser();
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof PasswordResetSchema>>({
|
const form = useForm<z.infer<typeof PasswordResetSchema>>({
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
export * from './components/password-reset-request-container';
|
export * from './components/password-reset-request-container';
|
||||||
export * from './components/password-reset-form';
|
export * from './components/update-password-form';
|
||||||
|
|||||||
Reference in New Issue
Block a user