diff --git a/.changeset/tall-bears-compete.md b/.changeset/tall-bears-compete.md new file mode 100644 index 000000000000..6929ba4d0afd --- /dev/null +++ b/.changeset/tall-bears-compete.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/web-ui-registration": patch +--- + +Fixed a bug that caused the Login page to crash when closing the Two-Factor Authentication modal using the Cancel button or the X button. diff --git a/packages/web-ui-registration/src/LoginForm.tsx b/packages/web-ui-registration/src/LoginForm.tsx index 55c638df6707..3290b9f16191 100644 --- a/packages/web-ui-registration/src/LoginForm.tsx +++ b/packages/web-ui-registration/src/LoginForm.tsx @@ -56,7 +56,7 @@ const LOGIN_SUBMIT_ERRORS = { }, } as const; -export type LoginErrors = keyof typeof LOGIN_SUBMIT_ERRORS; +export type LoginErrors = keyof typeof LOGIN_SUBMIT_ERRORS | 'totp-canceled'; export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRouter }): ReactElement => { const { @@ -111,7 +111,12 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute }, [errorOnSubmit]); const renderErrorOnSubmit = (error: LoginErrors) => { + if (error === 'totp-canceled') { + return null; + } + const { type, i18n } = LOGIN_SUBMIT_ERRORS[error]; + return ( {t(i18n)}