Skip to content
Open

[1005E] #8830

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
setStoredEnableAnimations,
setStoredSnackbarDuration
} from '../../utils/state';
import { USER_PASSWORD_MAX_LENGTH } from '../UserManagement/utils';

const decrementButtonSx: BoxProps['sx'] = {
borderTopRightRadius: 0,
Expand Down Expand Up @@ -279,6 +280,9 @@ export function AccountManagement(props: AccountManagementProps) {
onChange={(e) => {
setCurrentPassword(e.target.value);
}}
slotProps={{
htmlInput: { maxLength: USER_PASSWORD_MAX_LENGTH, autoComplete: 'current-password' }
}}
Comment thread
jvega190 marked this conversation as resolved.
/>
<PasswordTextField
margin="normal"
Expand All @@ -298,7 +302,9 @@ export function AccountManagement(props: AccountManagementProps) {
}
onFocus={(e) => setAnchorEl(e.target)}
onBlur={() => setAnchorEl(null)}
inputProps={{ autoComplete: 'new-password' }}
slotProps={{
htmlInput: { maxLength: USER_PASSWORD_MAX_LENGTH, autoComplete: 'new-password' }
}}
/>
<PasswordTextField
margin="normal"
Expand All @@ -318,6 +324,9 @@ export function AccountManagement(props: AccountManagementProps) {
/>
)
}
slotProps={{
htmlInput: { maxLength: USER_PASSWORD_MAX_LENGTH, autoComplete: 'new-password' }
}}
/>
<PrimaryButton
disabled={!validPassword || newPassword !== verifiedPassword || currentPassword === ''}
Expand Down
9 changes: 7 additions & 2 deletions studio-ui/ui/app/src/components/LoginView/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import Menu from '@mui/material/Menu';
import { useMount } from '../../hooks/useMount';
import { useDebouncedInput } from '../../hooks/useDebouncedInput';
import { PasswordStrengthDisplayPopper } from '../PasswordStrengthDisplayPopper';
import { USER_USERNAME_MAX_LENGTH } from '../UserManagement/utils';
import { USER_PASSWORD_MAX_LENGTH, USER_USERNAME_MAX_LENGTH } from '../UserManagement/utils';
import useTimer from '../../hooks/useTimer';
import { nnou } from '../../utils/object';
import moment from 'moment-timezone';
Expand Down Expand Up @@ -400,7 +400,9 @@ function ResetView(props: SubViewProps) {
placeholder={formatMessage(translations.resetPasswordFieldPlaceholderLabel)}
onFocus={(e) => setAnchorEl(e.target)}
onBlur={() => setAnchorEl(null)}
inputProps={{ autoComplete: 'new-password' }}
slotProps={{
htmlInput: { maxLength: USER_PASSWORD_MAX_LENGTH, autoComplete: 'new-password' }
}}
/>
<PasswordTextField
id="resetFormPasswordConfirmField"
Expand All @@ -414,6 +416,9 @@ function ResetView(props: SubViewProps) {
className={classes?.resetPassword}
sxs={{ root: { mb: 0 } }}
placeholder={formatMessage(translations.resetPasswordConfirmFieldPlaceholderLabel)}
slotProps={{
htmlInput: { maxLength: USER_PASSWORD_MAX_LENGTH, autoComplete: 'new-password' }
}}
/>
{children}
</DialogContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const translations = defineMessages({
});

const PasswordTextField = React.forwardRef<HTMLDivElement, PasswordTextFieldProps>((props, ref) => {
const { visibilitySwitch = true, initialVisible = false, sxs } = props;
const { visibilitySwitch = true, initialVisible = false, sxs, slotProps, InputProps, ...textFieldProps } = props;
const { formatMessage } = useIntl();
const [showPassword, setShowPassword] = useState(initialVisible);
const inputRef = useRef<HTMLInputElement>(undefined);
Expand All @@ -50,33 +50,41 @@ const PasswordTextField = React.forwardRef<HTMLDivElement, PasswordTextFieldProp
}, 0);
};

const visibilityAdornment = (
<InputAdornment position="end">
<IconButton
edge="end"
aria-label={formatMessage(translations.toggleVisibilityButtonText)}
onClick={handleClickShowPassword}
size="large"
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
);

return (
<TextField
{...props}
{...textFieldProps}
sx={sxs?.root}
ref={ref}
type={showPassword ? 'text' : 'password'}
slotProps={{
...slotProps,
htmlInput: {
...slotProps?.htmlInput,
ref: inputRef
},
input: visibilitySwitch
? {
...props.InputProps,
endAdornment: (
<InputAdornment position="end">
<IconButton
edge="end"
aria-label={formatMessage(translations.toggleVisibilityButtonText)}
onClick={handleClickShowPassword}
size="large"
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
)
...slotProps?.input,
...InputProps,
endAdornment: visibilityAdornment
}
: {
...slotProps?.input,
...InputProps
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
: props.InputProps
}}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { showSystemNotification } from '../../state/actions/system';
import PasswordTextField from '../PasswordTextField/PasswordTextField';
import { PasswordStrengthDisplayPopper } from '../PasswordStrengthDisplayPopper';
import { pushErrorDialog } from '../../utils/system';
import { USER_PASSWORD_MAX_LENGTH } from '../UserManagement/utils';

interface ResetPasswordDialogProps {
open: boolean;
Expand Down Expand Up @@ -109,7 +110,9 @@ function ResetPasswordDialogUI(props: ResetPasswordDialogProps) {
}}
onFocus={(e) => setAnchorEl(e.target)}
onBlur={() => setAnchorEl(null)}
inputProps={{ autoComplete: 'new-password' }}
slotProps={{
htmlInput: { maxLength: USER_PASSWORD_MAX_LENGTH, autoComplete: 'new-password' }
}}
/>
<PasswordStrengthDisplayPopper
open={Boolean(anchorEl)}
Expand Down