mirror of https://github.com/portainer/portainer
feat(auth): allow single char passwords [EE-3385] (#7050)
* feat(auth): allow single character passwords * match weak password modal logic to sliderfix/EE-3445/open-tooltip-on-hover
parent
6d6c70a98b
commit
f39775752d
|
@ -1,5 +1,6 @@
|
||||||
import { FormSectionTitle } from '@/portainer/components/form-components/FormSectionTitle';
|
import { FormSectionTitle } from '@/portainer/components/form-components/FormSectionTitle';
|
||||||
import { react2angular } from '@/react-tools/react2angular';
|
import { react2angular } from '@/react-tools/react2angular';
|
||||||
|
import { confirm } from '@/portainer/services/modal.service/confirm';
|
||||||
|
|
||||||
import { SaveAuthSettingsButton } from '../components/SaveAuthSettingsButton';
|
import { SaveAuthSettingsButton } from '../components/SaveAuthSettingsButton';
|
||||||
import { Settings } from '../../types';
|
import { Settings } from '../../types';
|
||||||
|
@ -19,6 +20,27 @@ export function InternalAuth({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
function onSubmit() {
|
||||||
|
if (value.RequiredPasswordLength < 10) {
|
||||||
|
confirm({
|
||||||
|
title: 'Allow weak passwords?',
|
||||||
|
message:
|
||||||
|
'You have set an insecure minimum password length. This could leave your system vulnerable to attack, are you sure?',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
label: 'Yes',
|
||||||
|
className: 'btn-danger',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
callback: function onConfirm(confirmed) {
|
||||||
|
if (confirmed) onSaveSettings();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
onSaveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FormSectionTitle>Information</FormSectionTitle>
|
<FormSectionTitle>Information</FormSectionTitle>
|
||||||
|
@ -34,7 +56,7 @@ export function InternalAuth({
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<PasswordLengthSlider
|
<PasswordLengthSlider
|
||||||
min={8}
|
min={1}
|
||||||
max={18}
|
max={18}
|
||||||
step={1}
|
step={1}
|
||||||
value={value.RequiredPasswordLength}
|
value={value.RequiredPasswordLength}
|
||||||
|
@ -42,7 +64,7 @@ export function InternalAuth({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SaveAuthSettingsButton onSubmit={onSaveSettings} isLoading={isLoading} />
|
<SaveAuthSettingsButton onSubmit={onSubmit} isLoading={isLoading} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue