mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
Make mail optional for user
This commit is contained in:
@@ -27,13 +27,13 @@ import { Links } from "./hal";
|
||||
export type DisplayedUser = {
|
||||
id: string;
|
||||
displayName: string;
|
||||
mail: string;
|
||||
mail?: string;
|
||||
};
|
||||
|
||||
export type User = {
|
||||
displayName: string;
|
||||
name: string;
|
||||
mail: string;
|
||||
mail?: string;
|
||||
password: string;
|
||||
active: boolean;
|
||||
type?: string;
|
||||
|
||||
@@ -113,8 +113,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
this.editUserComponentsAreUnchanged() ||
|
||||
this.state.mailValidationError ||
|
||||
this.state.displayNameValidationError ||
|
||||
this.isFalsy(user.displayName) ||
|
||||
this.isFalsy(user.mail)
|
||||
this.isFalsy(user.displayName)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -152,6 +151,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
// edit existing user
|
||||
subtitle = <Subtitle subtitle={t("userForm.subtitle")} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{subtitle}
|
||||
@@ -218,7 +218,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
|
||||
handleEmailChange = (mail: string) => {
|
||||
this.setState({
|
||||
mailValidationError: !validator.isMailValid(mail),
|
||||
mailValidationError: !!mail && !validator.isMailValid(mail),
|
||||
user: {
|
||||
...this.state.user,
|
||||
mail
|
||||
|
||||
@@ -46,7 +46,8 @@ public class UserDto extends HalRepresentation {
|
||||
private String displayName;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Instant lastModified;
|
||||
@NotEmpty @Email
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Email
|
||||
private String mail;
|
||||
@Pattern(regexp = ValidationUtil.REGEX_NAME)
|
||||
private String name;
|
||||
|
||||
Reference in New Issue
Block a user