Fix template strings with a starting "/"

This commit is contained in:
CodeSteak 2020-06-17 00:02:46 +02:00
parent e037b75f7c
commit 18cbfbf148
2 changed files with 9 additions and 10 deletions

View File

@ -1,9 +1,5 @@
package org.hso.ecommerce.controller.intern.customers;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.hso.ecommerce.controller.intern.accounting.AccountingController;
import org.hso.ecommerce.controller.intern.accounting.AccountingController.ShortTemplateBookingResult;
import org.hso.ecommerce.entities.booking.Booking;
@ -13,12 +9,13 @@ import org.hso.ecommerce.repos.booking.BookingRepository;
import org.hso.ecommerce.repos.shop.CustomerOrderRepository;
import org.hso.ecommerce.repos.user.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Optional;
@Controller
@ -104,17 +101,17 @@ public class CustomersIndexController {
) {
if (!password.equals(password2)) {
request.setAttribute("error", "Passwörter stimmen nicht überein!");
return "/intern/customers/id";
return "intern/customers/id";
}
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";
return "intern/customers/id";
}
user.setPassword("12345");
userRepository.save(user);
request.setAttribute("info", "Passwort wurde auf 12345 geändert!");
return "/intern/customers/id";
return "intern/customers/id";
}
}

View File

@ -7,7 +7,9 @@ import org.hso.ecommerce.repos.shop.CategoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -45,6 +47,6 @@ public class ShopSearchController {
return "error/404";
}
return "/shop/search";
return "shop/search";
}
}