Bug 31378: Add OPAC support for authentication providers

Signed-off-by: Lukasz Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Agustin Moyano 2022-08-23 12:00:47 -03:00 committed by Tomas Cohen Arazi
parent 208b9b5ba7
commit 1e12281ace
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
3 changed files with 62 additions and 0 deletions

View File

@ -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 %]
<p class="clearfix">
<a href="[% provider.url | url %]" class="btn btn-light col-md-12" id="provider_[% provider.code | html %]">
[% IF provider.icon_url %]
<img src="[% provider.icon_url | url %]" />
[% ELSE %]
<i class="fa fa-user" aria-hidden="true"></i>
[% END %]
Log in with [% provider.description | html %]
</a>
</p>
[% END %]
<hr/>
<p>If you do not have an external account, but do have a local account, you can still log in: </p>
[% END # /IF auth_providers.size %]
<input type="hidden" name="koha_login_context" value="opac" />
<fieldset class="brief">
<div class="local-login">

View File

@ -2,6 +2,7 @@
[% USE Koha %]
[% USE Categories %]
[% USE AdditionalContents %]
[% USE AuthClient %]
[% PROCESS 'html_helpers.inc' %]
[% SET OpacLoginInstructions = AdditionalContents.get( location => "OpacLoginInstructions", lang => lang, library => branchcode || default_branch ) %]
[% INCLUDE 'doc-head-open.inc' %]
@ -76,6 +77,13 @@
</div>
[% END %]
[% IF auth_error %]
<div class="alert alert-info">
<p>There was an error authenticating to external identity provider</p>
<p>[% auth_error | html %]</p>
</div>
[% END %]
[% IF ( shibbolethAuthentication ) %]
[% IF ( invalidShibLogin ) %]
<!-- This is what is displayed if shibboleth login has failed to match a koha user -->
@ -155,6 +163,24 @@
[% END # / IF casAuthentication %]
[% SET auth_providers = AuthClient.get_providers('opac') %]
[% IF ( ! auth_providers.empty ) %]
[% FOREACH provider IN auth_providers %]
<p class="clearfix">
<a href="[% provider.url | url %]" class="btn btn-light col-md-12" id="provider_[% provider.code | html %]">
[% IF provider.icon_url %]
<img src="[% provider.icon_url | url %]" style="max-height: 20px; max-width: 20px;"/>
[% ELSE %]
<i class="fa fa-user" aria-hidden="true"></i>
[% END %]
Log in with [% provider.description | html %]
</a>
</p>
[% END %]
<hr/>
<p>If you do not have an external account, but do have a local account, you can still log in: </p>
[% END # /IF auth_providers %]
[% IF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
[% IF ( invalidGoogleOpenIDConnectLogin ) %]
<h2>Google login</h2>

View File

@ -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 @@
<a href="/cgi-bin/koha/svc/auth/googleopenidconnect" class="btn btn-light" id="openid_connect"><i class="fa fa-google" aria-hidden="true"></i> Log in with Google</a>
<p>If you do not have a Google account, but do have a local account, you can still log in: </p>
[% END # /IF GoogleOpenIDConnect %]
[% SET auth_providers = AuthClient.get_providers('opac') %]
[% IF ( ! auth_providers.empty ) %]
[% FOREACH provider IN auth_providers %]
<p class="clearfix">
<a href="[% provider.url | url %]" class="btn btn-light col-md-12" id="provider_[% provider.code | html %]">
[% IF provider.icon_url %]
<img src="[% provider.icon_url | url %]" style="max-height: 20px; max-width: 20px;"/>
[% ELSE %]
<i class="fa fa-user" aria-hidden="true"></i>
[% END %]
Log in with [% provider.description | html %]
</a>
</p>
[% END %]
<hr/>
<p>If you do not have an external account, but do have a local account, you can still log in: </p>
[% END # /IF auth_providers.size %]
<div class="local-login">
<label for="userid">Login:</label>
<input class="form-control" type="text" id="userid" name="userid" autocomplete="off" />