Проверка повтора пароля не проходит
Есть SessionServlet, проверяющий запросы на корректность и отправляющий ответ. При попытке проверки пароля(password) с паролем для повторного ввода(secpass) должен посылаться ответ об ошибке, что пароли не совпадают. Но !pass.equals(secpass) не работает.
public SessionsServlet(AccountService accountService) {
this.accountService = accountService;
//get logged user
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException {
String login = request.getParameter("login");
String pass = request.getParameter("pass");
String secpass= request.getParameter("secpass");
String sessionId = request.getSession().getId();
UserProfile profile = accountService.getUserBySessionId(sessionId);
if (profile == null || !pass.equals(secpass) || login==null) {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
} else {
Gson gson = new Gson();
String json = gson.toJson(profile);
response.getWriter().println("Success");
response.setContentType("text/html;charset=utf-8");
response.getWriter().println(json);
response.setStatus(HttpServletResponse.SC_OK);
}
}