mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:25:49 +00:00
disabled email in update form
This commit is contained in:
parent
a175a83f34
commit
8f21109239
4 changed files with 6 additions and 2 deletions
|
@ -125,7 +125,7 @@ class PetController extends WebSocketSender {
|
|||
return CommonView.PET_CREATE_OR_UPDATE;
|
||||
}
|
||||
else {
|
||||
owner.addPet(pet);
|
||||
pet.setOwner(owner);
|
||||
this.petService.save(pet);
|
||||
sendSuccessMessage(CommonWebSocket.PET_UPDATED);
|
||||
return CommonView.OWNER_OWNERS_ID_R;
|
||||
|
|
|
@ -123,7 +123,9 @@ public class PetService implements BaseService<Pet, PetDTO> {
|
|||
@Override
|
||||
public PetDTO save(PetDTO petDTO) {
|
||||
Pet pet = dtoToEntity(petDTO);
|
||||
Owner owner = pet.getOwner();
|
||||
pet = petRepository.save(pet);
|
||||
pet.setOwner(owner);
|
||||
|
||||
return entityToDTO(pet);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />
|
||||
<input th:case="'password'" class="form-control" type="password" th:field="*{__${name}__}" />
|
||||
<input th:case="'email'" class="form-control" type="email" th:field="*{__${name}__}" />
|
||||
<input th:case="'emaildisabled'" class="form-control" type="email" th:field="*{__${name}__}" disabled/>
|
||||
<input th:case="'date'" class="form-control" type="text" th:field="*{__${name}__}"
|
||||
placeholder="YYYY-MM-DD" title="Enter a date in this format: YYYY-MM-DD"
|
||||
pattern="(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))"/>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<h2>User update</h2>
|
||||
<form th:object="${user}" class="form-horizontal" id="add-user-form" method="post">
|
||||
<input type="hidden" th:field="${user.id}" />
|
||||
<input type="hidden" th:field="${user.email}" />
|
||||
<input type="hidden" th:field="${user.password}" />
|
||||
<input type="hidden" th:field="${user.matchingPassword}" />
|
||||
<input type="hidden" th:field="${user.enabled}" />
|
||||
|
@ -17,7 +18,7 @@
|
|||
|
||||
<div class="form-group has-feedback">
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Email', 'email', 'email')}" disabled />
|
||||
th:replace="~{fragments/inputField :: input ('Email', 'email', 'emaildisabled')}" />
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('First Name', 'firstName', 'text')}" />
|
||||
<input
|
||||
|
|
Loading…
Reference in a new issue