Skip to content

Return an accurate Account Deactivated error when user is deactivated - #2867

Draft
szabozoltan69 wants to merge 1 commit into
developfrom
fix/accurate-login-message
Draft

szabozoltan69 wants to merge 1 commit into
developfrom
fix/accurate-login-message

Conversation

@szabozoltan69

Copy link
Copy Markdown
Contributor

Refers to IFRCGo/go-web-app#855


Has go-web-app side task also:

app/src/views/Login/index.tsx currently does this on failure:

onFailure: (error) => {
    const { value: { formErrors } } = error;
    setError(transformObjectError(formErrors, () => undefined));
    alert.show(strings.loginFailureMessage, { variant: 'danger' }); // hardcoded, generic
},

app/src/utils/restRequest/go.ts already has logic that recognizes go-api's {statusCode, error_message} shape ("Old Standard Error") and turns it into formErrors.non_field_errors = [error_message] / messageForNotification = error_message. That means our new error_message ("Your account is deactivated...") will already surface via on the form — without any frontend change.

However, error_code (our new 4013) is currently dropped entirely by transformError — it only reads statusCode/error_message, nothing else. So the frontend has no reliable way to branch on it today.

The gap / recommended go-web-app task

Toast is misleading today: alert.show(strings.loginFailureMessage, ...) always shows the same generic hardcoded message regardless of the real reason, while the accurate message only appears in the smaller NonFieldError box. At minimum, this should show error.value.messageForNotification instead of the static string, so the deactivated message is prominent, not just incidental.

(Better) Surface error_code: thread error_code through TransformedError/transformError in go.ts so Login/index.tsx can check error.value.errorCode === 4013 explicitly and render a dedicated message/action (e.g. a clickable mailto:im@ifrc.org link) instead of relying on string matching against English backend text — this also avoids any i18n mismatch since the backend message is English-only.

Add an i18n string (i18n.json) for the "account deactivated" message if they want it localized client-side rather than displaying the raw backend text.

@szabozoltan69

Copy link
Copy Markdown
Contributor Author

@frozenhelium – if you have any thoughts about this, welcome!

@szabozoltan69
szabozoltan69 force-pushed the fix/accurate-login-message branch from 4ea9fa1 to dbbc11d Compare October 15, 2026 08:51
@szabozoltan69
szabozoltan69 force-pushed the fix/accurate-login-message branch from dbbc11d to a3c9682 Compare October 15, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants