Compare commits

...

3 Commits

3 changed files with 8 additions and 11 deletions

View File

@ -94,25 +94,22 @@ public class CustomersIndexController {
} }
@PostMapping("/{id}/resetPassword") @PostMapping("/{id}/resetPassword")
public String resetPassword(@PathVariable("id") Long id, public String resetPassword(Model model,
@PathVariable("id") Long id,
@RequestParam("password") String password, @RequestParam("password") String password,
@RequestParam("password2") String password2, @RequestParam("password2") String password2,
HttpServletResponse response,
HttpServletRequest request HttpServletRequest request
) { ) {
if (!password.equals(password2)) { if (!password.equals(password2)) {
request.setAttribute("error", "Passwörter stimmen nicht überein!"); request.setAttribute("error", "Passwörter stimmen nicht überein!");
return "intern/customers/id"; return internCustomersId(model, id, response, request);
} }
User user = userRepository.findById(id).get(); User user = userRepository.findById(id).get();
if (!user.validatePassword(password)) { user.setPassword(password);
request.setAttribute("error", "Die Passwörter stimmen nicht mit dem Original überein!");
return "intern/customers/id";
}
user.setPassword("12345");
userRepository.save(user); userRepository.save(user);
request.setAttribute("info", "Passwort wurde auf 12345 geändert!");
return "intern/customers/id"; return "redirect:/intern/customers/" + id.toString();
} }
} }

View File

@ -33,7 +33,7 @@
<input type="hidden" id="ref_hidden" th:value="${ArticleID.offerID}" name="ref-article" /> <input type="hidden" id="ref_hidden" th:value="${ArticleID.offerID}" name="ref-article" />
<a th:href="${'/intern/supplierOffers/#q=' + ArticleID.id}">Details</a> <a th:href="${'/intern/supplierOffers/#q=' + ArticleID.offerID}">Details</a>
</p> </p>
<div class="spacer"></div> <div class="spacer"></div>
<div class="m"> <div class="m">

View File

@ -44,7 +44,7 @@
<tr th:each="order : ${SupplierDetail.orders}"> <tr th:each="order : ${SupplierDetail.orders}">
<td><span th:text="${order.id}"></span></td> <td><span th:text="${order.id}"></span></td>
<td><span th:text="${order.dateOrder}"></span></td> <td><span th:text="${order.dateOrder}"></span></td>
<td><a th:href="@{/intern/articles/{id}(id = ${order.articleId})}" class="button smaller" th:text="${order.articleName}"></a></td> <td><span th:text="${order.articleName}"></span></td>
<td><span th:text="${order.priceNet}"></span></td> <td><span th:text="${order.priceNet}"></span></td>
<td><span th:text="${order.quantity}"></span></td> <td><span th:text="${order.quantity}"></span></td>
<td><span th:text="${order.priceTotal}"></span></td> <td><span th:text="${order.priceTotal}"></span></td>