From f39775752d1d0c85ae75fedb48e2e896bfebef6f Mon Sep 17 00:00:00 2001 From: itsconquest Date: Thu, 16 Jun 2022 12:31:36 +1200 Subject: [PATCH] feat(auth): allow single char passwords [EE-3385] (#7050) * feat(auth): allow single character passwords * match weak password modal logic to slider --- .../internal-auth/InternalAuth.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/app/portainer/settings/authentication/internal-auth/InternalAuth.tsx b/app/portainer/settings/authentication/internal-auth/InternalAuth.tsx index 78c7cf178..51cc1bf00 100644 --- a/app/portainer/settings/authentication/internal-auth/InternalAuth.tsx +++ b/app/portainer/settings/authentication/internal-auth/InternalAuth.tsx @@ -1,5 +1,6 @@ import { FormSectionTitle } from '@/portainer/components/form-components/FormSectionTitle'; import { react2angular } from '@/react-tools/react2angular'; +import { confirm } from '@/portainer/services/modal.service/confirm'; import { SaveAuthSettingsButton } from '../components/SaveAuthSettingsButton'; import { Settings } from '../../types'; @@ -19,6 +20,27 @@ export function InternalAuth({ value, onChange, }: 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 ( <> Information @@ -34,7 +56,7 @@ export function InternalAuth({
- + ); }