Merge pull request #36 from rkheftan/fix/submit-form
fix: submit with enter in enter password form
This commit is contained in:
@@ -142,61 +142,73 @@ export const EnterPasswordForm = ({
|
|||||||
</LTRBox>
|
</LTRBox>
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Box
|
||||||
<Typography variant="body2" color="textSecondary" sx={{ mt: 1, mb: 2 }}>
|
component="form"
|
||||||
{t('enterPassword.enterThePasswordYouSetForYourAccount')}
|
onSubmit={(e) => {
|
||||||
</Typography>
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
<TextField
|
if (!loginWithPassLoading) {
|
||||||
label={t('enterPassword.loginPassword')}
|
void handleSubmit();
|
||||||
type={showPassword ? 'text' : 'password'}
|
}
|
||||||
value={passValue}
|
|
||||||
inputRef={inputRef}
|
|
||||||
onChange={(e) => setPassValue(e.target.value)}
|
|
||||||
onBlur={handleBlur}
|
|
||||||
error={!passValue && inputTouched}
|
|
||||||
helperText={
|
|
||||||
!passValue && inputTouched ? t('loginForm.thisFieldIsRequired') : ''
|
|
||||||
}
|
|
||||||
autoFocus
|
|
||||||
slotProps={{
|
|
||||||
htmlInput: { sx: { lineHeight: 1.5 } },
|
|
||||||
input: {
|
|
||||||
endAdornment: (
|
|
||||||
<IconButton
|
|
||||||
color="primary"
|
|
||||||
onClick={() => setShowPassword(!showPassword)}
|
|
||||||
>
|
|
||||||
{showPassword ? (
|
|
||||||
<Icon Component={Eye} />
|
|
||||||
) : (
|
|
||||||
<Icon Component={EyeSlash} />
|
|
||||||
)}
|
|
||||||
</IconButton>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
sx={{ my: 4 }}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
onClick={handleLoginWithOtp}
|
|
||||||
sx={{ width: 'auto', mb: 2 }}
|
|
||||||
variant="text"
|
|
||||||
loading={emailResendLoading || smsResendLoading}
|
|
||||||
endIcon={<Icon Component={ArrowLeft} />}
|
|
||||||
>
|
>
|
||||||
{t('enterPassword.loginWithOneTimeCode')}
|
<Typography variant="body2" color="textSecondary" sx={{ mt: 1, mb: 2 }}>
|
||||||
</Button>
|
{t('enterPassword.enterThePasswordYouSetForYourAccount')}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
<Stack spacing={1}>
|
<TextField
|
||||||
<Button loading={loginWithPassLoading} onClick={handleSubmit}>
|
label={t('enterPassword.loginPassword')}
|
||||||
{t('verify.confirmAndLogin')}
|
type={showPassword ? 'text' : 'password'}
|
||||||
|
value={passValue}
|
||||||
|
inputRef={inputRef}
|
||||||
|
onChange={(e) => setPassValue(e.target.value)}
|
||||||
|
onBlur={handleBlur}
|
||||||
|
error={!passValue && inputTouched}
|
||||||
|
helperText={
|
||||||
|
!passValue && inputTouched ? t('loginForm.thisFieldIsRequired') : ''
|
||||||
|
}
|
||||||
|
autoFocus
|
||||||
|
slotProps={{
|
||||||
|
htmlInput: { sx: { lineHeight: 1.5 } },
|
||||||
|
input: {
|
||||||
|
endAdornment: (
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
|
>
|
||||||
|
{showPassword ? (
|
||||||
|
<Icon Component={Eye} />
|
||||||
|
) : (
|
||||||
|
<Icon Component={EyeSlash} />
|
||||||
|
)}
|
||||||
|
</IconButton>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
sx={{ my: 4 }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={handleLoginWithOtp}
|
||||||
|
sx={{ width: 'auto', mb: 2 }}
|
||||||
|
variant="text"
|
||||||
|
loading={emailResendLoading || smsResendLoading}
|
||||||
|
endIcon={<Icon Component={ArrowLeft} />}
|
||||||
|
>
|
||||||
|
{t('enterPassword.loginWithOneTimeCode')}
|
||||||
</Button>
|
</Button>
|
||||||
<Link to="/forget-password">
|
|
||||||
<Button variant="text">{t('enterPassword.iForgotMyPassword')}</Button>
|
<Stack spacing={1}>
|
||||||
</Link>
|
<Button loading={loginWithPassLoading}>
|
||||||
</Stack>
|
{t('verify.confirmAndLogin')}
|
||||||
|
</Button>
|
||||||
|
<Link to="/forget-password">
|
||||||
|
<Button variant="text">
|
||||||
|
{t('enterPassword.iForgotMyPassword')}
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</AuthenticationCard>
|
</AuthenticationCard>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user