core: make user's name field fully options

closes #1537

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-05 11:23:27 +02:00
parent 2716a26887
commit 73d57d6f82
3 changed files with 6 additions and 4 deletions

View file

@ -90,6 +90,9 @@ class UserSerializer(ModelSerializer):
"attributes", "attributes",
"uid", "uid",
] ]
extra_kwargs = {
"name": {"allow_blank": True},
}
class UserSelfSerializer(ModelSerializer): class UserSelfSerializer(ModelSerializer):
@ -117,6 +120,7 @@ class UserSelfSerializer(ModelSerializer):
] ]
extra_kwargs = { extra_kwargs = {
"is_active": {"read_only": True}, "is_active": {"read_only": True},
"name": {"allow_blank": True},
} }

View file

@ -58,12 +58,11 @@ export class UserForm extends ModelForm<User, number> {
${t`Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.`} ${t`Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.`}
</p> </p>
</ak-form-element-horizontal> </ak-form-element-horizontal>
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name"> <ak-form-element-horizontal label=${t`Name`} name="name">
<input <input
type="text" type="text"
value="${ifDefined(this.instance?.name)}" value="${ifDefined(this.instance?.name)}"
class="pf-c-form-control" class="pf-c-form-control"
required
/> />
<p class="pf-c-form__helper-text">${t`User's display name.`}</p> <p class="pf-c-form__helper-text">${t`User's display name.`}</p>
</ak-form-element-horizontal> </ak-form-element-horizontal>

View file

@ -55,12 +55,11 @@ export class UserSelfForm extends ModelForm<UserSelf, number> {
${t`Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.`} ${t`Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.`}
</p> </p>
</ak-form-element-horizontal> </ak-form-element-horizontal>
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name"> <ak-form-element-horizontal label=${t`Name`} name="name">
<input <input
type="text" type="text"
value="${ifDefined(this.instance?.name)}" value="${ifDefined(this.instance?.name)}"
class="pf-c-form-control" class="pf-c-form-control"
required
/> />
<p class="pf-c-form__helper-text">${t`User's display name.`}</p> <p class="pf-c-form__helper-text">${t`User's display name.`}</p>
</ak-form-element-horizontal> </ak-form-element-horizontal>