Add email success flag to control redirections in emailSuccess.jsp page

This commit is contained in:
Sofia Baltzi 2018-03-13 12:34:34 +00:00
parent d42f4f223f
commit 55712350b0
3 changed files with 11 additions and 1 deletions

View File

@ -59,7 +59,8 @@ public class RemindUsernameServlet extends HttpServlet {
emailSender.sendEmail(formEmail, verificationCodeSubject, verificationCodeMsg);
response.sendRedirect("./emailSuccess.jsp");
response.sendRedirect(UrlConstructor.getRedirectUrl(request, "emailSuccess.jsp"));
//response.sendRedirect("./emailSuccess.jsp");
} else {
request.getSession().setAttribute("message", "User not found");

View File

@ -36,6 +36,9 @@ public class UrlConstructor {
if (jspPage.equals("registerSuccess.jsp")) {
request.getSession().setAttribute("registerSuccess", "true");
}
if (jspPage.equals("emailSuccess.jsp")) {
request.getSession().setAttribute("emailSuccess", "true");
}
return resultPath;
}

View File

@ -8,6 +8,12 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% if (session.getAttribute("emailSuccess") == null) {
String redirectURL = request.getContextPath() + "/error404.jsp";
response.sendRedirect(redirectURL);
} else if (session.getAttribute("emailSuccess") != null) {
session.removeAttribute("emailSuccess");
}%>
<META HTTP-EQUIV=Refresh CONTENT="0.5; URL=http://beta.services.openaire.eu/uoa-user-management/openid_connect_login">
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>