Conflict resolution fix between master and local for login redirect.
authorTerran McCanna <tmccanna@georgialibraries.org>
Mon, 10 Jan 2022 19:40:35 +0000 (14:40 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 15 Aug 2022 18:25:50 +0000 (14:25 -0400)
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates-bootstrap/opac/parts/login/form.tt2

index 6a02c3b..8da09da 100755 (executable)
@@ -13,7 +13,8 @@
     ELSIF ctx.login_failed_event.textcode == 'PATRON_INACTIVE';
         l("This account has been deactivated.  <br>Please contact your local library.");
     ELSE;
-        l("Login failed.<br> The username or password provided was not valid.<br>Passwords and user names are case-sensitive.<br>Check your Caps-Lock key and try again or contact your local library.");
+        l("Login failed. <br> The username or password provided was not valid. <br>" _
+           "Passwords and user names are case-sensitive.  <br>Check your Caps-Lock key and try again or contact your local library.");
     END;
 %]
 </div>
        </div>
 </div>
 
+        <div style="clear: both; padding-top: 15px;" class="col-12 text-center">
+        [%
+            redirect = CGI.param('redirect_to');
+            # Don't use referer unless we got here from elsewhere within the TPAC
+            IF !redirect AND ctx.referer.match('^https?://' _ ctx.hostname _ ctx.opac_root);
+                redirect = ctx.referer;
+            END;
+            # If no redirect is offered or it's leading us back to the
+            # login form, redirect the user to My Account
+            IF !redirect OR redirect.match(ctx.path_info _ '$');
+                redirect = CGI.url('-full' => 1) _ '/opac/myopac/main';
+            END;
+                redirect = redirect  | replace('^http:', 'https:');
+            %]
+            <input type='hidden' name='redirect_to' value='[% redirect | html %]'/>
+
+        </div>
         <input id="client_tz_id" name="client_tz" type="hidden" />
     </form>