2022-11-28 02:00:28 +00:00
|
|
|
import { AlertTriangle, Check } from 'lucide-react';
|
|
|
|
|
2022-09-21 06:14:29 +00:00
|
|
|
import { usePublicSettings } from '@/react/portainer/settings/queries';
|
2022-04-14 01:45:54 +00:00
|
|
|
|
2022-07-26 05:17:54 +00:00
|
|
|
import { Icon } from '@@/Icon';
|
|
|
|
|
2022-06-15 04:01:19 +00:00
|
|
|
interface Props {
|
|
|
|
passwordValid: boolean;
|
|
|
|
forceChangePassword?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function PasswordCheckHint({
|
|
|
|
passwordValid,
|
|
|
|
forceChangePassword,
|
|
|
|
}: Props) {
|
2022-06-03 04:00:13 +00:00
|
|
|
const settingsQuery = usePublicSettings();
|
|
|
|
const minPasswordLength = settingsQuery.data?.RequiredPasswordLength;
|
2022-04-14 01:45:54 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2022-09-14 23:09:19 +00:00
|
|
|
<p className="text-warning vertical-center">
|
2022-11-28 02:00:28 +00:00
|
|
|
<Icon icon={AlertTriangle} className="icon-warning" />
|
2022-06-15 04:01:19 +00:00
|
|
|
{forceChangePassword &&
|
|
|
|
'An administrator has changed your password requirements, '}
|
2022-06-03 04:00:13 +00:00
|
|
|
The password must be at least {minPasswordLength} characters long.
|
2022-06-15 04:01:19 +00:00
|
|
|
{passwordValid && (
|
2022-11-28 02:00:28 +00:00
|
|
|
<Icon icon={Check} className="!ml-1" mode="success" />
|
2022-06-15 04:01:19 +00:00
|
|
|
)}
|
2022-04-14 01:45:54 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|