Skip to content

Commit

Permalink
fix: rename ResetPassword to ForgotPassword (#4730)
Browse files Browse the repository at this point in the history
* fix: rename ResetPassword to ForgotPassword

* Create fuzzy-cars-beg.md

* fix a couple more namespaces
  • Loading branch information
calebpollman authored Nov 15, 2023
1 parent b39d956 commit 2ab62de
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 28 deletions.
6 changes: 6 additions & 0 deletions .changeset/fuzzy-cars-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@aws-amplify/ui-react-native": patch
"@aws-amplify/ui-react": patch
---

fix: rename ResetPassword to ForgotPassword
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const components = {
return <Text>Footer Information</Text>;
},
},
ResetPassword: {
ForgotPassword: {
Header() {
const { tokens } = useTheme();
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
getBackToSignInText,
} = authenticatorTextUtil;

const ResetPassword = ({
const ForgotPassword = ({
fields,
handleBlur,
handleChange,
Expand Down Expand Up @@ -77,9 +77,9 @@ const ResetPassword = ({
);
};

ResetPassword.Footer = DefaultFooter;
ResetPassword.FormFields = DefaultTextFormFields;
ResetPassword.Header = DefaultHeader;
ForgotPassword.Footer = DefaultFooter;
ForgotPassword.FormFields = DefaultTextFormFields;
ForgotPassword.Header = DefaultHeader;

ResetPassword.displayName = COMPONENT_NAME;
export default ResetPassword;
ForgotPassword.displayName = COMPONENT_NAME;
export default ForgotPassword;
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {
getBackToSignInText,
} = authenticatorTextUtil;

describe('ResetPassword', () => {
describe('ForgotPassword', () => {
it('renders as expected', () => {
const { toJSON, getAllByRole, getByText } = render(
<ForgotPassword {...props} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ResetPassword renders an error message 1`] = `
exports[`ForgotPassword renders an error message 1`] = `
[
<Text
accessibilityRole="header"
Expand Down Expand Up @@ -320,7 +320,7 @@ exports[`ResetPassword renders an error message 1`] = `
]
`;

exports[`ResetPassword renders as expected 1`] = `
exports[`ForgotPassword renders as expected 1`] = `
[
<Text
accessibilityRole="header"
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/src/Authenticator/Defaults/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ type ForceNewPasswordComponent<P = {}> = OverrideComponents<
{ style?: ForceNewPasswordStyle } & P
>['ForceNewPassword'];

type ResetPasswordComponent<P = {}> = OverrideComponents<
type ForgotPasswordComponent<P = {}> = OverrideComponents<
TextFieldOptionsType,
{ style?: ResetPasswordStyle } & P
>['ForgotPassword'];
Expand Down Expand Up @@ -152,7 +152,7 @@ export interface Components {
ConfirmResetPassword?: ConfirmResetPasswordComponent;
ConfirmVerifyUser?: ConfirmVerifyUserComponent;
ForceNewPassword?: ForceNewPasswordComponent;
ResetPassword?: ResetPasswordComponent;
ForgotPassword?: ForgotPasswordComponent;
SetupTotp?: SetupTotpComponent;
SignIn?: SignInComponent;
SignUp?: SignUpComponent;
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Authenticator/Authenticator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { SetupTotp } from './SetupTotp';
import { SignIn } from './SignIn';
import { SignUp } from './SignUp';
import { ForceNewPassword } from './ForceNewPassword';
import { ResetPassword } from './ForgotPassword';
import { ForgotPassword } from './ForgotPassword';
import { defaultComponents } from './hooks/useCustomComponents/defaultComponents';

export type SignOut = UseAuthenticator['signOut'];
Expand Down Expand Up @@ -152,7 +152,7 @@ export function Authenticator(props: AuthenticatorProps): JSX.Element {
}

Authenticator.Provider = Provider;
Authenticator.ResetPassword = ResetPassword;
Authenticator.ForgotPassword = ForgotPassword;
Authenticator.SetupTotp = SetupTotp;
Authenticator.SignIn = SignIn;
Authenticator.SignUp = SignUp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {
getResetYourPasswordText,
} = authenticatorTextUtil;

export const ResetPassword = ({
export const ForgotPassword = ({
className,
variation,
}: RouteProps): JSX.Element => {
Expand All @@ -28,9 +28,9 @@ export const ResetPassword = ({
const {
components: {
// @ts-ignore
ResetPassword: {
Header = ResetPassword.Header,
Footer = ResetPassword.Footer,
ForgotPassword: {
Header = ForgotPassword.Header,
Footer = ForgotPassword.Footer,
},
},
} = useCustomComponents();
Expand All @@ -39,7 +39,7 @@ export const ResetPassword = ({
<RouteContainer className={className} variation={variation}>
<form
data-amplify-form=""
data-amplify-authenticator-resetpassword=""
data-amplify-authenticator-Forgotpassword=""
method="post"
onChange={handleChange}
onSubmit={handleSubmit}
Expand Down Expand Up @@ -70,11 +70,11 @@ export const ResetPassword = ({
);
};

ResetPassword.Header = function Header(): JSX.Element {
ForgotPassword.Header = function Header(): JSX.Element {
return <Heading level={3}>{getResetYourPasswordText()}</Heading>;
};

ResetPassword.Footer = function Footer(): JSX.Element {
ForgotPassword.Footer = function Footer(): JSX.Element {
// @ts-ignore
return null;
};
4 changes: 2 additions & 2 deletions packages/react/src/components/Authenticator/Router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SetupTotp } from '../SetupTotp';
import { SignInSignUpTabs } from '../shared';
import { ConfirmVerifyUser, VerifyUser } from '../VerifyUser';
import { ConfirmSignIn } from '../ConfirmSignIn/ConfirmSignIn';
import { ConfirmResetPassword, ResetPassword } from '../ForgotPassword';
import { ConfirmResetPassword, ForgotPassword } from '../ForgotPassword';
import { isSignInOrSignUpRoute } from '../utils';
import { RouterProps } from './types';

Expand Down Expand Up @@ -37,7 +37,7 @@ const getRouteComponent = (route: string): RouteComponent => {
case 'forceNewPassword':
return ForceNewPassword;
case 'forgotPassword':
return ResetPassword;
return ForgotPassword;
case 'confirmResetPassword':
return ConfirmResetPassword;
case 'verifyUser':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ForceNewPassword } from '../../ForceNewPassword';
import { SetupTotp } from '../../SetupTotp';
import { ConfirmSignIn } from '../../ConfirmSignIn/ConfirmSignIn';
import { ConfirmVerifyUser, VerifyUser } from '../../VerifyUser';
import { ConfirmResetPassword, ResetPassword } from '../../ForgotPassword';
import { ConfirmResetPassword, ForgotPassword } from '../../ForgotPassword';

// use the very generic name of Components as this is a temporary interface and is not exported
interface Components {
Expand All @@ -20,7 +20,7 @@ export interface DefaultComponents extends Omit<Components, 'FormFields'> {
ConfirmResetPassword?: Omit<Components, 'FormFields'>;
ConfirmVerifyUser?: Omit<Components, 'FormFields'>;
ForceNewPassword?: Components;
ResetPassword?: Omit<Components, 'FormFields'>;
ForgotPassword?: Omit<Components, 'FormFields'>;
SetupTotp?: Omit<Components, 'FormFields'>;
SignIn?: Omit<Components, 'FormFields'>;
SignUp?: Components;
Expand Down Expand Up @@ -69,9 +69,9 @@ export const defaultComponents: DefaultComponents = {
Footer: ForceNewPassword.Footer,
FormFields: ForceNewPassword.FormFields,
},
ResetPassword: {
Header: ResetPassword.Header,
Footer: ResetPassword.Footer,
ForgotPassword: {
Header: ForgotPassword.Header,
Footer: ForgotPassword.Footer,
},
// @ts-ignore
Footer: (): JSX.Element => null,
Expand Down

0 comments on commit 2ab62de

Please sign in to comment.