From 7874d600b953ff5cdd57ae49b72816f7279f55be Mon Sep 17 00:00:00 2001 From: jeb228 Date: Tue, 11 Jan 2011 20:57:49 +0000 Subject: [PATCH] NIHVIVO-1568 NIHVIVO-1645 roll back the changes from r6909 --- .../webapp/controller/edit/Authenticate.java | 50 ++++--------------- .../controller/edit/AuthenticateTest.java | 5 ++ 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java index f113fa91f..a8f6f502b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java @@ -89,8 +89,9 @@ public class Authenticate extends VitroHttpServlet { VitroRequest vreq = new VitroRequest(request); try { - restartTheProcessIfAppropriate(vreq); - recordLoginProcessPages(vreq); + if (loginProcessPagesAreEmpty(vreq)) { + recordLoginProcessPages(vreq); + } // Where do we stand in the process? State entryState = getCurrentLoginState(vreq); @@ -138,37 +139,11 @@ public class Authenticate extends VitroHttpServlet { } /** - * Try to detect if they are re-starting the login process. + * Once these URLs have been set, don't change them. */ - private void restartTheProcessIfAppropriate(HttpServletRequest request) { - String afterLoginUrl = decodeAfterLoginParameter(request); - boolean doReturn = isReturnParameterSet(request); - String referrer = whereDidWeComeFrom(request); - - /* - * If they have navigated to a restricted page, restart the process. - */ - if (afterLoginUrl != null) { - LoginProcessBean.removeBean(request); - } - - /* - * If they have used a login link, restart the process. - */ - if (doReturn) { - LoginProcessBean.removeBean(request); - } - - /* - * If they are using a login widget that is not the one they were - * previously using, restart the process. - */ - if (LoginProcessBean.isBean(request)) { - LoginProcessBean bean = LoginProcessBean.getBean(request); - if (!referrer.equals(bean.getLoginPageUrl())) { - LoginProcessBean.removeBean(request); - } - } + private boolean loginProcessPagesAreEmpty(HttpServletRequest request) { + LoginProcessBean bean = LoginProcessBean.getBean(request); + return ((bean.getAfterLoginUrl() == null) && (bean.getLoginPageUrl() == null)); } /** @@ -178,8 +153,7 @@ public class Authenticate extends VitroHttpServlet { * If they supply a return flag, record the current page as the after-login * page and use the Login page for the process. * - * Otherwise, use the current page for the process (unless the process has - * already been set). + * Otherwise, use the current page for the process. * * The "current page" is the referrer, unless there is no referrer for some * reason. In that case, pretend it's the login page. @@ -198,12 +172,8 @@ public class Authenticate extends VitroHttpServlet { bean.setAfterLoginUrl(referrer); bean.setLoginPageUrl(request.getContextPath() + Controllers.LOGIN); } else { - if (bean.getAfterLoginUrl() == null) { - bean.setAfterLoginUrl(referrer); - } - if (bean.getLoginPageUrl() == null) { - bean.setLoginPageUrl(referrer); - } + bean.setAfterLoginUrl(referrer); + bean.setLoginPageUrl(referrer); } } diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java index 8f263c933..90e2dba2a 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java @@ -212,6 +212,7 @@ public class AuthenticateTest extends AbstractTestClass { // ---------------------------------------------------------------------- /** The "return" parameter is set, so we detect the restart. */ + @Ignore @Test public void restartFromALoginLink() { setProcessBean(LOGGING_IN, "username", URL_LOGIN, URL_SOMEWHERE_ELSE); @@ -219,6 +220,7 @@ public class AuthenticateTest extends AbstractTestClass { } /** The "return" parameter is set, so we detect the restart. */ + @Ignore @Test public void restartFromABookmarkOfTheLoginLink() { setProcessBean(LOGGING_IN, "username", URL_LOGIN, URL_SOMEWHERE_ELSE); @@ -226,6 +228,7 @@ public class AuthenticateTest extends AbstractTestClass { } /** The "afterLoginUrl" parameter is set, so we detect the restart. */ + @Ignore @Test public void restartFromARestrictedPage() { setProcessBean(LOGGING_IN, "username", URL_LOGIN, URL_SOMEWHERE_ELSE); @@ -233,6 +236,7 @@ public class AuthenticateTest extends AbstractTestClass { } /** The referrer is not the loginProcessPage, so we detect the restart. */ + @Ignore @Test public void restartFromADifferentWidgetPage() { setProcessBean(LOGGING_IN, "username", URL_LOGIN, URL_SOMEWHERE_ELSE); @@ -240,6 +244,7 @@ public class AuthenticateTest extends AbstractTestClass { } /** The referrer is not the loginProcessPage, so we detect the restart. */ + @Ignore @Test public void restartFromTheLoginPageWhenWeWereUsingAWidgetPage() { setProcessBean(LOGGING_IN, "username", URL_SOMEWHERE_ELSE,