From d0a0f3140da5e7adea6f489557c566990203cbf1 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 24 Sep 2014 11:05:21 -0400
Subject: [PATCH] Simplified home action; made strategy validation more
 consistent.

---
 module/VuFind/src/VuFind/Auth/ChoiceAuth.php              | 4 ++--
 .../VuFind/src/VuFind/Controller/MyResearchController.php | 8 +-------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/module/VuFind/src/VuFind/Auth/ChoiceAuth.php b/module/VuFind/src/VuFind/Auth/ChoiceAuth.php
index 2a64a5ed3a7..a34988878fe 100644
--- a/module/VuFind/src/VuFind/Auth/ChoiceAuth.php
+++ b/module/VuFind/src/VuFind/Auth/ChoiceAuth.php
@@ -322,10 +322,10 @@ class ChoiceAuth extends AbstractBase
         // Set new strategy; fall back to old one if there is a problem:
         $defaultStrategy = $this->strategy;
         $this->strategy = trim($request->getPost()->get('auth_method'));
-        if (null === $this->strategy) {
+        if (empty($this->strategy)) {
             $this->strategy = trim($request->getQuery()->get('auth_method'));
         }
-        if ($this->strategy == '') {
+        if (empty($this->strategy)) {
             $this->strategy = $defaultStrategy;
             if (empty($this->strategy)) {
                 throw new AuthException('authentication_error_technical');
diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index 2baf0a1f2bc..dbf51132e20 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -84,18 +84,12 @@ class MyResearchController extends AbstractBase
      */
     public function homeAction()
     {
-        // if the current auth class proxies others, we'll get the proxied
-        //   auth method as a querystring or post parameter.
-        //   Force to post.
-        if ($method = trim($this->params()->fromQuery('auth_method'))) {
-            $this->getRequest()->getPost()->set('auth_method', $method);
-        }
-
         // Process login request, if necessary (either because a form has been
         // submitted or because we're using an external login provider):
         if ($this->params()->fromPost('processLogin')
             || $this->getSessionInitiator()
             || $this->params()->fromPost('auth_method')
+            || $this->params()->fromQuery('auth_method')
         ) {
             try {
                 $this->getAuthManager()->login($this->getRequest());
-- 
GitLab