remove advertisementflag
This commit is contained in:
parent
5b4c0be1c8
commit
83ad1f3999
|
@ -53,12 +53,6 @@ public class UpdateUserSettingsAction {
|
|||
return new UpdateResult(true);
|
||||
}
|
||||
|
||||
public UpdateResult updateAdvertisementFlag(boolean advertisementFlag){
|
||||
this.user.isAdvertisementActivated = advertisementFlag;
|
||||
this.repository.save(this.user);
|
||||
return new UpdateResult(true);
|
||||
}
|
||||
|
||||
public UpdateResult updatePaymentInfo(String creditCardNumber){
|
||||
UpdateResult result = new UpdateResult(false);
|
||||
if(creditCardNumber.matches("[0-9]+")){
|
||||
|
|
|
@ -107,22 +107,6 @@ public class UserController {
|
|||
return "user/settings";
|
||||
}
|
||||
|
||||
@PostMapping("/settings/changeAdSettings")
|
||||
public String changeAdSettings(HttpSession session,
|
||||
@RequestParam("ad") String ad,
|
||||
HttpServletRequest request
|
||||
) {
|
||||
User user = userRepository.findById((long) session.getAttribute("userId")).get();
|
||||
|
||||
UpdateUserSettingsAction cusa = new UpdateUserSettingsAction(user, userRepository);
|
||||
UpdateUserSettingsAction.UpdateResult result = cusa.updateAdvertisementFlag(ad.equals("y"));
|
||||
if (result.updated == false) {
|
||||
request.setAttribute("error", result.errorString);
|
||||
}
|
||||
|
||||
return "user/settings";
|
||||
}
|
||||
|
||||
@PostMapping("/settings/changePaymentInfo")
|
||||
public String changePaymentInfo(HttpSession session,
|
||||
@RequestParam("creditCardNumber") String creditCardNumber,
|
||||
|
|
|
@ -33,7 +33,6 @@ public class User {
|
|||
|
||||
public boolean isActive;
|
||||
public boolean isEmployee;
|
||||
public boolean isAdvertisementActivated;
|
||||
|
||||
@Embedded
|
||||
public Address defaultDeliveryAddress;
|
||||
|
|
|
@ -91,21 +91,6 @@
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<form class="detailflex" method="POST" th:action="@{/user/settings/changeAdSettings}">
|
||||
<div>
|
||||
<h2> Werbung </h2>
|
||||
</div>
|
||||
<div>
|
||||
<fieldset>
|
||||
<input type="radio" name="ad" value="y" id="ad-y" required th:checked="${user.isAdvertisementActivated}">
|
||||
<label for="type-priv">Ich möchte Werbung erhalten.</label> <br/>
|
||||
<input type="radio" name="ad" value="n" id="ad-n" required th:checked="${!user.isAdvertisementActivated}">
|
||||
<label for="type-bus">Ich möchte keine Werbung erhalten.</label> <br/>
|
||||
</fieldset>
|
||||
<button type="submit"> Speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form class="detailflex" method="POST" th:action="@{/user/settings/changePaymentInfo}">
|
||||
<div>
|
||||
<h2> Zahlungsinformation</h2>
|
||||
|
|
Reference in New Issue