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); diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json index 05613e17f..687383778 100644 --- a/app/soapbox/locales/en.json +++ b/app/soapbox/locales/en.json @@ -169,6 +169,7 @@ "app_create.scopes_placeholder": "e.g. 'read write follow'", "app_create.submit": "Create app", "app_create.website_label": "Website", + "auth.awaiting_approval": "Your account is awaiting approval", "auth.invalid_credentials": "Wrong username or password", "auth.logged_out": "Logged out.", "auth_layout.register": "Create an account",