Skip to content
Snippets Groups Projects
Commit b56afd26 authored by Ziwei Wang's avatar Ziwei Wang Committed by Adrien Béraud
Browse files

Fix: Helper text is not showing when the password is too weak

The commit ae51d70f changed the data type of the password status from string enums to number. Hence, it can't be used
as the context by the translation module. The intended behaviour now is to show helper text only when the password is
too weak. As a quick fix, I put the text for too weak in the component. If we ever want to generate the helper text
dynamically, we will need to correctly map the status number to the context text for translation module.

Change-Id: I09d1a06f32eb1e32a451a3bfcf4f91872a044e75
parent cf08e35e
No related branches found
No related tags found
No related merge requests found
...@@ -149,7 +149,8 @@ export const PasswordInput = ({ ...@@ -149,7 +149,8 @@ export const PasswordInput = ({
t('password_input_helper_text_strong') t('password_input_helper_text_strong')
t('password_input_helper_text_registration_failed') t('password_input_helper_text_registration_failed')
*/ */
const helperText = t('password_input_helper_text', { context: `${status}` }) // TODO: The status is not string anymore, hence it can't be used as a context to fetch the correct translation.
// const helperText = t('password_input_helper_text', { context: `${status}` })
return ( return (
<> <>
...@@ -161,7 +162,7 @@ export const PasswordInput = ({ ...@@ -161,7 +162,7 @@ export const PasswordInput = ({
type={showPassword ? 'text' : 'password'} type={showPassword ? 'text' : 'password'}
variant="standard" variant="standard"
autoComplete="current-password" autoComplete="current-password"
helperText={status === PasswordStrength.TooWeak ? helperText : ''} helperText={status === PasswordStrength.TooWeak ? t('password_input_helper_text_too_weak') : ''}
onFocus={() => setIsSelected(true)} onFocus={() => setIsSelected(true)}
onBlur={() => setIsSelected(false)} onBlur={() => setIsSelected(false)}
{...props} {...props}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment