Add redirect home link at registerSuccess.jsp emailSuccess.jsp successAddPassword.jsp and in session at ActivationServlet.java, RemindUsernameServlet.java,
This commit is contained in:
parent
2bc3eb044e
commit
3390ceb4a8
|
@ -5,6 +5,7 @@ import eu.dnetlib.openaire.user.utils.VerificationActions;
|
|||
import eu.dnetlib.openaire.usermanagement.utils.UrlConstructor;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
|
@ -33,6 +34,8 @@ public class ActivationCodeServlet extends HttpServlet{
|
|||
@Autowired
|
||||
private LDAPActions ldapActions;
|
||||
|
||||
@Value("${oidc.home}")
|
||||
private String oidcHomeUrl;
|
||||
|
||||
private Logger logger = Logger.getLogger(ActivationCodeServlet.class);
|
||||
|
||||
|
@ -48,6 +51,7 @@ public class ActivationCodeServlet extends HttpServlet{
|
|||
if (!verificationActions.verificationCodeHasExpired(formUsername)) {
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("username", formUsername);
|
||||
session.setAttribute("homeUrl", oidcHomeUrl);
|
||||
try {
|
||||
ldapActions.moveUser(formUsername);
|
||||
} catch (Exception e) {
|
||||
|
@ -69,4 +73,12 @@ public class ActivationCodeServlet extends HttpServlet{
|
|||
printWriter.close();
|
||||
|
||||
}
|
||||
|
||||
public String getOidcHomeUrl() {
|
||||
return oidcHomeUrl;
|
||||
}
|
||||
|
||||
public void setOidcHomeUrl(String oidcHomeUrl) {
|
||||
this.oidcHomeUrl = oidcHomeUrl;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import eu.dnetlib.openaire.user.utils.LDAPActions;
|
|||
import eu.dnetlib.openaire.usermanagement.utils.UrlConstructor;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
|
||||
|
||||
|
@ -15,6 +16,7 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
@ -35,12 +37,18 @@ public class RemindUsernameServlet extends HttpServlet {
|
|||
@Autowired
|
||||
private EmailSender emailSender;
|
||||
|
||||
@Value("${oidc.home}")
|
||||
private String oidcHomeUrl;
|
||||
|
||||
private Logger logger = Logger.getLogger(RemindUsernameServlet.class);
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String formEmail = request.getParameter("email").trim();
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("homeUrl", oidcHomeUrl);
|
||||
|
||||
if (formEmail == null){
|
||||
request.getSession().setAttribute("message", "Error reading email.");
|
||||
response.sendRedirect("./remindUsername.jsp");
|
||||
|
@ -80,4 +88,12 @@ public class RemindUsernameServlet extends HttpServlet {
|
|||
|
||||
}
|
||||
|
||||
public String getOidcHomeUrl() {
|
||||
return oidcHomeUrl;
|
||||
}
|
||||
|
||||
public void setOidcHomeUrl(String oidcHomeUrl) {
|
||||
this.oidcHomeUrl = oidcHomeUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.dnetlib.openaire.usermanagement.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
@ -47,9 +46,4 @@ public class UrlConstructor {
|
|||
|
||||
return resultPath;
|
||||
}
|
||||
|
||||
|
||||
// public static void redirectToHome(HttpServletRequest request){
|
||||
// request.getSession().setAttribute("redirectHomeUrl", oidcHomeUrl);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
} 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">
|
||||
<%--<META HTTP-EQUIV=Refresh CONTENT="0.5; URL=http://beta.services.openaire.eu/uoa-user-management/openid_connect_login">--%>
|
||||
<META HTTP-EQUIV=Refresh CONTENT='0.5; URL=<%= session.getAttribute("homeUrl")%>'>
|
||||
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
} else if (session.getAttribute("registerSuccess") != null) {
|
||||
session.removeAttribute("registerSuccess");
|
||||
}%>
|
||||
<META HTTP-EQUIV=Refresh CONTENT="0.5; URL=http://beta.services.openaire.eu/uoa-user-management/openid_connect_login">
|
||||
<%--<META HTTP-EQUIV=Refresh CONTENT="0.5; URL=http://beta.services.openaire.eu/uoa-user-management/openid_connect_login">--%>
|
||||
<META HTTP-EQUIV=Refresh CONTENT='0.5; URL=<%= session.getAttribute("homeUrl")%>'>
|
||||
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
} else if (session.getAttribute("successAddPassword") != null) {
|
||||
session.removeAttribute("successAddPassword");
|
||||
}%>
|
||||
<META HTTP-EQUIV=Refresh CONTENT="0.5; URL=http://beta.services.openaire.eu/uoa-user-management/openid_connect_login">
|
||||
<%--<META HTTP-EQUIV=Refresh CONTENT="0.5; URL=http://beta.services.openaire.eu/uoa-user-management/openid_connect_login">--%>
|
||||
<META HTTP-EQUIV=Refresh CONTENT='0.5; URL=<%= session.getAttribute("homeUrl")%>'>
|
||||
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
|
Loading…
Reference in New Issue