From e197cca02de5e3db0dfe4017dd78427c5b984685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 20 Jan 2023 12:09:04 +0100 Subject: [PATCH] Show appropriate message when account is awaiting approval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/actions/auth.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/soapbox/actions/auth.ts b/app/soapbox/actions/auth.ts index a0ef8b447..06fe848e2 100644 --- a/app/soapbox/actions/auth.ts +++ b/app/soapbox/actions/auth.ts @@ -50,6 +50,7 @@ const customApp = custom('app'); export const messages = defineMessages({ loggedOut: { id: 'auth.logged_out', defaultMessage: 'Logged out.' }, + awaitingApproval: { id: 'auth.awaiting_approval', defaultMessage: 'Your account is awaiting approval' }, invalidCredentials: { id: 'auth.invalid_credentials', defaultMessage: 'Wrong username or password' }, }); @@ -187,6 +188,8 @@ export const logIn = (username: string, password: string) => if ((error.response?.data as any)?.error === 'mfa_required') { // If MFA is required, throw the error and handle it in the component. throw error; + } else if ((error.response?.data as any)?.identifier === 'awaiting_approval') { + toast.error(messages.awaitingApproval); } else { // Return "wrong password" message. toast.error(messages.invalidCredentials);