From 0b5879350e6bfaeb538755b9408eda88b2e501cd Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Tue, 23 Aug 2022 12:00:47 -0300 Subject: [PATCH] Bug 31378: Add OPAC support for authentication providers Signed-off-by: Lukasz Koszyk Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens --- .../bootstrap/en/includes/masthead.inc | 18 +++++++++++++ .../bootstrap/en/modules/opac-auth.tt | 26 +++++++++++++++++++ .../bootstrap/en/modules/opac-main.tt | 18 +++++++++++++ 3 files changed, 62 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 8c3e8575a7a..f8c97c1780c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -2,6 +2,7 @@ [% USE Koha %] [% USE Branches %] [% USE Categories %] +[% USE AuthClient %] [% USE AdditionalContents %] [% PROCESS 'html_helpers.inc' %] [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] @@ -384,6 +385,23 @@ [% END %] [% END %] [% UNLESS Koha.Preference('opacShibOnly') %] + [% SET auth_providers = AuthClient.get_providers('opac') %] + [% IF ( ! auth_providers.empty ) %] + [% FOREACH provider IN auth_providers %] +

+ + [% IF provider.icon_url %] + + [% ELSE %] + + [% END %] + Log in with [% provider.description | html %] + +

+ [% END %] +
+

If you do not have an external account, but do have a local account, you can still log in:

+ [% END # /IF auth_providers.size %]
[% END %] + [% IF auth_error %] +
+

There was an error authenticating to external identity provider

+

[% auth_error | html %]

+
+ [% END %] + [% IF ( shibbolethAuthentication ) %] [% IF ( invalidShibLogin ) %] @@ -155,6 +163,24 @@ [% END # / IF casAuthentication %] + [% SET auth_providers = AuthClient.get_providers('opac') %] + [% IF ( ! auth_providers.empty ) %] + [% FOREACH provider IN auth_providers %] +

+ + [% IF provider.icon_url %] + + [% ELSE %] + + [% END %] + Log in with [% provider.description | html %] + +

+ [% END %] +
+

If you do not have an external account, but do have a local account, you can still log in:

+ [% END # /IF auth_providers %] + [% IF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %] [% IF ( invalidGoogleOpenIDConnectLogin ) %]

Google login

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt index 3d7f3f41254..fabd4e8df30 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -5,6 +5,7 @@ [% USE Categories %] [% USE Price %] [% USE AdditionalContents %] +[% USE AuthClient %] [% PROCESS 'i18n.inc' %] [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] @@ -191,6 +192,23 @@ Log in with Google

If you do not have a Google account, but do have a local account, you can still log in:

[% END # /IF GoogleOpenIDConnect %] + [% SET auth_providers = AuthClient.get_providers('opac') %] + [% IF ( ! auth_providers.empty ) %] + [% FOREACH provider IN auth_providers %] +

+ + [% IF provider.icon_url %] + + [% ELSE %] + + [% END %] + Log in with [% provider.description | html %] + +

+ [% END %] +
+

If you do not have an external account, but do have a local account, you can still log in:

+ [% END # /IF auth_providers.size %]