Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRO-2449 Fixes i18n processing of login throttle message #3635

Merged
merged 1 commit into from Jan 24, 2022
Merged

Conversation

abea
Copy link
Contributor

@abea abea commented Jan 21, 2022

Summary

Resolves PRO-2449. The string was using a pluralization namespace method, but due to the "(s)" part was not taking advantage of pluralization, so it does not need to be using __ns_n().

What are the specific steps to test this change?

  1. Pull and install the https://github.com/apostrophecms/apostrophe-boilerplate/tree/temp-pro-2449 branch of apostrophe-boilerplate for A2.
  2. Create a user, then attempt to log in three times with an incorrect password. Without this change, you will get a 500 error, shutting down the site. With this change, you see an error message that you'll have to wait 120 minutes.

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@abea abea requested a review from boutell January 21, 2022 21:00
@abea abea self-assigned this Jan 21, 2022
@@ -455,7 +455,7 @@ module.exports = {
}

self.getThrottleLoginErr = function (req, minutes) {
return req.__ns_n(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not really using __ns_n anywhere else. looked at the i18n docs for the related method and I don't know if our string here would work. We could change the arguments passed to the original method, though I wasn't clear on that using our wrapper method and there weren't relevant other usages to use as a guide. Ultimately using the simpler method gets this message the same place it woudl have got to before.

Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being 2.x, we should do the simplest non-buggy thing that has no significant impact, and this fix appears to be that.

@abea abea merged commit 3130c05 into 2.0 Jan 24, 2022
@abea abea deleted the PRO-2449-throttle branch January 24, 2022 16:39
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.

None yet

2 participants