diff --git a/app/react/portainer/users/ListView/NewUserForm/NewUserForm.tsx b/app/react/portainer/users/ListView/NewUserForm/NewUserForm.tsx
index 88dc6811b..812c7de61 100644
--- a/app/react/portainer/users/ListView/NewUserForm/NewUserForm.tsx
+++ b/app/react/portainer/users/ListView/NewUserForm/NewUserForm.tsx
@@ -9,8 +9,6 @@ import { notifySuccess } from '@/portainer/services/notifications';
import { Widget } from '@@/Widget';
import { FormActions } from '@@/form-components/FormActions';
-import { PasswordCheckHint } from '@@/PasswordCheckHint';
-import { FormControl } from '@@/form-components/FormControl';
import { useTeams } from '../../teams/queries';
import { useCreateUserMutation } from '../../queries/useCreateUserMutation';
@@ -80,10 +78,6 @@ export function NewUserForm() {
-
-
-
-
>
)}
diff --git a/app/react/portainer/users/ListView/NewUserForm/TeamsField.tsx b/app/react/portainer/users/ListView/NewUserForm/TeamsField.tsx
index 4f5886ad5..40e36457c 100644
--- a/app/react/portainer/users/ListView/NewUserForm/TeamsField.tsx
+++ b/app/react/portainer/users/ListView/NewUserForm/TeamsField.tsx
@@ -1,5 +1,6 @@
import { useField } from 'formik';
+import { Link } from '@@/Link';
import { TeamsSelector } from '@@/TeamsSelector';
import { FormControl } from '@@/form-components/FormControl';
@@ -19,15 +20,26 @@ export function TeamsField({
return (
- setValue(value)}
- value={value}
- name={name}
- teams={teams}
- inputId="teams-field"
- disabled={disabled}
- />
+ {teams.length > 0 ? (
+ setValue(value)}
+ value={value}
+ name={name}
+ teams={teams}
+ inputId="teams-field"
+ disabled={disabled}
+ />
+ ) : (
+
+ You don't seem to have any teams to add users into. Head over to
+ the{' '}
+
+ Teams view
+ {' '}
+ to create some.
+
+ )}
);
}
diff --git a/app/react/portainer/users/ListView/NewUserForm/useValidation.tsx b/app/react/portainer/users/ListView/NewUserForm/useValidation.tsx
index ba7f3caf7..6b8d15fce 100644
--- a/app/react/portainer/users/ListView/NewUserForm/useValidation.tsx
+++ b/app/react/portainer/users/ListView/NewUserForm/useValidation.tsx
@@ -43,7 +43,13 @@ export function useValidation(): SchemaOf {
function passwordValidation(minLength: number | undefined = 12) {
return object({
- password: string().required('Password is required').min(minLength, ''),
+ password: string()
+ .required('Password is required')
+ .min(
+ minLength,
+ ({ value, min }) =>
+ `The password must be at least ${min} characters long. (${value.length}/${min})`
+ ),
confirmPassword: string().oneOf(
[ref('password'), null],
'Passwords must match'