Merge pull request 'fix_change_user_name' (#104) from fix_change_user_name into master

This commit is contained in:
CodeSteak 2020-06-21 00:15:57 +02:00
commit 2989b54593
7 changed files with 7 additions and 8 deletions

BIN
prototype/e-commerce.db.old Normal file

Binary file not shown.

View File

@ -48,7 +48,7 @@ public class UpdateUserSettingsAction {
public UpdateResult updateShippingInfo(String salutation, String name, String address) { public UpdateResult updateShippingInfo(String salutation, String name, String address) {
this.user.salutation = salutation; this.user.salutation = salutation;
this.user.name = name; this.user.defaultDeliveryAddress.name = name;
this.user.defaultDeliveryAddress.addressString = address; this.user.defaultDeliveryAddress.addressString = address;
this.repository.save(this.user); this.repository.save(this.user);
return new UpdateResult(true); return new UpdateResult(true);

View File

@ -1,6 +1,7 @@
package org.hso.ecommerce.components; package org.hso.ecommerce.components;
import org.hso.ecommerce.entities.booking.PaymentMethod; import org.hso.ecommerce.entities.booking.PaymentMethod;
import org.hso.ecommerce.entities.shop.Address;
import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.entities.user.User;
import org.hso.ecommerce.repos.user.UserRepository; import org.hso.ecommerce.repos.user.UserRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +24,8 @@ public class AdminInitializer {
// create first admin user // create first admin user
User firstAdmin = new User(); User firstAdmin = new User();
firstAdmin.created = new Timestamp(System.currentTimeMillis()); firstAdmin.created = new Timestamp(System.currentTimeMillis());
firstAdmin.name = "admin"; firstAdmin.defaultDeliveryAddress = new Address();
firstAdmin.defaultDeliveryAddress.name = "admin";
firstAdmin.defaultPayment = new PaymentMethod(); firstAdmin.defaultPayment = new PaymentMethod();
firstAdmin.defaultPayment.creditCardNumber = ""; //set empty number firstAdmin.defaultPayment.creditCardNumber = ""; //set empty number
firstAdmin.email = "admin"; firstAdmin.email = "admin";

View File

@ -24,9 +24,6 @@ public class User {
@Column(unique = true) @Column(unique = true)
public String email; public String email;
@Column(insertable = false, updatable = false)
public String name;
public String salutation; public String salutation;
public String passwordHash; public String passwordHash;

View File

@ -41,7 +41,7 @@
</tr> </tr>
<tr> <tr>
<th>Name</th> <th>Name</th>
<td th:text="${user.name}"></td> <td th:text="${user.defaultDeliveryAddress.name}"></td>
</tr> </tr>
<tr> <tr>
<th>E-Mail</th> <th>E-Mail</th>

View File

@ -42,7 +42,7 @@
<tr th:each="user: ${users}"> <tr th:each="user: ${users}">
<td th:text="${user.id}"></td> <td th:text="${user.id}"></td>
<td th:text="${user.created.toString().substring(0, 10)}"></td> <td th:text="${user.created.toString().substring(0, 10)}"></td>
<td th:text="${user.name}"></td> <td th:text="${user.defaultDeliveryAddress.name}"></td>
<td th:text="${user.email}"></td> <td th:text="${user.email}"></td>
<td> <td>
<span th:text="${user.isActive} ? 'Aktiv,' : 'Inaktiv,'"></span> <span th:text="${user.isActive} ? 'Aktiv,' : 'Inaktiv,'"></span>

View File

@ -73,7 +73,7 @@
</div> </div>
<div> <div>
<label for="name">Name</label> <label for="name">Name</label>
<input class="full-width" type="text" name="name" id="name" placeholder="Nachname Vorname" th:value="${user.name}" <input class="full-width" type="text" name="name" id="name" placeholder="Nachname Vorname" th:value="${user.defaultDeliveryAddress.name}"
required/> required/>
</div> </div>
</div> </div>