Compare commits

...
This repository has been archived on 2020-08-02. You can view files and clone it, but cannot push or open issues or pull requests.

4 Commits

4 changed files with 8 additions and 12 deletions

View File

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

View File

@ -7,7 +7,6 @@ spring.datasource.url=jdbc:sqlite:./e-commerce.db
spring.datasource.driverClassName=org.sqlite.JDBC
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLiteDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
# Session
#spring.session.store-type=jdbc
#spring.session.jdbc.initialize-schema=always

View File

@ -33,7 +33,7 @@
<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>
<div class="spacer"></div>
<div class="m">

View File

@ -44,7 +44,7 @@
<tr th:each="order : ${SupplierDetail.orders}">
<td><span th:text="${order.id}"></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.quantity}"></span></td>
<td><span th:text="${order.priceTotal}"></span></td>