mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-05 11:50:58 +01:00
Require password for creation of internal user (#2027)
This commit is contained in:
2
gradle/changelog/user_password.yaml
Normal file
2
gradle/changelog/user_password.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Require password for internal user creation ([#2027](https://github.com/scm-manager/scm-manager/pull/2027))
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
Level,
|
||||
Modal,
|
||||
PasswordConfirmation,
|
||||
SubmitButton
|
||||
SubmitButton,
|
||||
} from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
@@ -47,12 +47,12 @@ const UserConverter: FC<Props> = ({ user }) => {
|
||||
const {
|
||||
isLoading: isConvertingToInternal,
|
||||
error: convertingToInternalError,
|
||||
convertToInternal
|
||||
convertToInternal,
|
||||
} = useConvertToInternal();
|
||||
const {
|
||||
isLoading: isConvertingToExternal,
|
||||
error: convertingToExternalError,
|
||||
convertToExternal
|
||||
convertToExternal,
|
||||
} = useConvertToExternal();
|
||||
const error = convertingToExternalError || convertingToInternalError || undefined;
|
||||
const isLoading = isConvertingToExternal || isConvertingToInternal;
|
||||
@@ -114,7 +114,7 @@ const UserConverter: FC<Props> = ({ user }) => {
|
||||
<SubmitButton
|
||||
action={() => password && passwordValid && convertToInternal(user, password)}
|
||||
loading={isLoading}
|
||||
disabled={!passwordValid || isLoading}
|
||||
disabled={!password || !passwordValid || isLoading}
|
||||
scrollToTop={false}
|
||||
label={t("userForm.modal.convertToInternal")}
|
||||
/>
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
PasswordConfirmation,
|
||||
SubmitButton,
|
||||
Subtitle,
|
||||
validation as validator
|
||||
validation as validator,
|
||||
} from "@scm-manager/ui-components";
|
||||
import * as userValidator from "./userValidation";
|
||||
|
||||
@@ -50,7 +50,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
password: "",
|
||||
active: true,
|
||||
external: false,
|
||||
_links: {}
|
||||
_links: {},
|
||||
});
|
||||
const [mailValidationError, setMailValidationError] = useState(false);
|
||||
const [displayNameValidationError, setDisplayNameValidationError] = useState(false);
|
||||
@@ -91,6 +91,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
mailValidationError ||
|
||||
displayNameValidationError ||
|
||||
nameValidationError ||
|
||||
(userState && !userState.external && !userState.password) ||
|
||||
!userState.displayName
|
||||
);
|
||||
};
|
||||
@@ -118,7 +119,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
<div className="column is-half">
|
||||
<InputField
|
||||
label={t("user.name")}
|
||||
onChange={name => {
|
||||
onChange={(name) => {
|
||||
setNameValidationError(!!name && !validator.isNameValid(name));
|
||||
setUserState({ ...userState, name });
|
||||
}}
|
||||
@@ -144,7 +145,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
<div className="column is-half">
|
||||
<InputField
|
||||
label={t("user.displayName")}
|
||||
onChange={displayName => {
|
||||
onChange={(displayName) => {
|
||||
setDisplayNameValidationError(!userValidator.isDisplayNameValid(displayName));
|
||||
setUserState({ ...userState, displayName });
|
||||
}}
|
||||
@@ -158,7 +159,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
<div className="column is-half">
|
||||
<InputField
|
||||
label={t("user.mail")}
|
||||
onChange={mail => {
|
||||
onChange={(mail) => {
|
||||
setMailValidationError(!!mail && !validator.isMailValid(mail));
|
||||
setUserState({ ...userState, mail });
|
||||
}}
|
||||
@@ -176,7 +177,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
<div className="column">
|
||||
<Checkbox
|
||||
label={t("user.externalFlag")}
|
||||
onChange={external => setUserState({ ...userState, external })}
|
||||
onChange={(external) => setUserState({ ...userState, external })}
|
||||
checked={userState.external}
|
||||
helpText={t("help.externalFlagHelpText")}
|
||||
/>
|
||||
@@ -191,7 +192,7 @@ const UserForm: FC<Props> = ({ submitForm, user, loading }) => {
|
||||
<div className="column">
|
||||
<Checkbox
|
||||
label={t("user.active")}
|
||||
onChange={active => setUserState({ ...userState, active })}
|
||||
onChange={(active) => setUserState({ ...userState, active })}
|
||||
checked={userState ? userState.active : false}
|
||||
helpText={t("help.activeHelpText")}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user