Skip to content

Commit

Permalink
feat(Login): update localization strings and improve error handling f…
Browse files Browse the repository at this point in the history
…or two-factor authentication
  • Loading branch information
Chisomchima committed Feb 28, 2025
1 parent d679c5f commit 4f28c6c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
15 changes: 9 additions & 6 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2025-02-26T10:01:36.204Z\n"
"PO-Revision-Date: 2025-02-26T10:01:36.204Z\n"
"POT-Creation-Date: 2025-02-28T12:18:41.444Z\n"
"PO-Revision-Date: 2025-02-28T12:18:41.444Z\n"

msgid "Please confirm that you are not a robot by checking the checkbox."
msgstr "Please confirm that you are not a robot by checking the checkbox."
Expand Down Expand Up @@ -179,6 +179,9 @@ msgstr "Something went wrong"
msgid "Incorrect username or password"
msgstr "Incorrect username or password"

msgid "Authentication code is required"
msgstr "Authentication code is required"

msgid "Incorrect authentication code"
msgstr "Incorrect authentication code"

Expand All @@ -201,11 +204,11 @@ msgid "Enter the code from your two-factor authentication app to log in."
msgstr "Enter the code from your two-factor authentication app to log in."

msgid ""
"We have sent you an email with your authentication code, enter it below to "
"log in"
"We have sent you an email with your authentication code. Enter it below to "
"log in."
msgstr ""
"We have sent you an email with your authentication code, enter it below to "
"log in"
"We have sent you an email with your authentication code. Enter it below to "
"log in."

msgid "Username or email"
msgstr "Username or email"
Expand Down
5 changes: 4 additions & 1 deletion src/pages/login/InnerLoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ export const InnerLoginForm = ({
return () => clearTimeout(timer)
}, [])

const resendCode = async() => {
const resendCode = async () => {
setIsResetButtonPressed(true)
setIsResendDisabled(true)
form.change('twoFA', undefined)

// Wait for the state update to complete
await new Promise((resolve) => setTimeout(resolve, 0))

await handleSubmit()
setTimeout(() => {
setIsResendDisabled(false)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/login/LoginErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ LoginErrors.propTypes = {
lngs: PropTypes.arrayOf(PropTypes.string),
passwordExpired: PropTypes.bool,
passwordResetEnabled: PropTypes.bool,
twoFAIncorrect: PropTypes.bool,
twoFAError: PropTypes.bool,
twoFAIncorrect: PropTypes.bool,
unknownStatus: PropTypes.bool,
}
2 changes: 1 addition & 1 deletion src/pages/login/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const LoginForm = ({
passwordResetEnabled,
unknownStatus,
error,
setError,
loading,
setFormUserName,
lngs,
Expand All @@ -31,6 +30,7 @@ export const LoginForm = ({
}

const handleLogin = (values) => {
console.log(isResetButtonPressed, 'isResetButtonPressed')
setFormSubmitted(true)
if (
!checkIsLoginFormValid(values) ||
Expand Down

0 comments on commit 4f28c6c

Please sign in to comment.