Koha/koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc
Chris Cormack 493dcede48 Bug 9587 : Mozilla Persona login
Working on Mozilla Persona support (browser id)

    This will let a user log into Koha using browser id, if their email
    address used matches the email address inside Koha.

    Once an assertion is received, we simply need to find the user that
    matches that email address, and create a session for them.

    opac/svc/login handles this part.

    The nice thing about it is, the user doesn't have to do anything, like
    linking their account. As long as the email address they are using to
    identify themselves in browserid is the same as the one in Koha it
    will just work.

    This is covered by a systempreference, to allow people to do it, and
    is of course totally opt in, it works alongside normal Koha (or any
    other method) of login. So only those choosing to use it, need use it

Test Plan

1/ Make sure OPACBaseURL is set correctly
2/ Switch on the Persona syspref
3/ Make a borrower (or edit one) to have the email you plan to use as
the primary email
4/ Click sign in with email, make or use a persona account
5/ Logout
6/ Check you can still login and logout the normal way

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Works great.
It's not browser dependent, but tested with chrome, firefox, opera and safari.
Old an new login system works.
Minor errors, addresed in follow-up.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-02-24 10:15:35 -05:00

100 lines
4.1 KiB
HTML

[% IF ( opaccredits ) %]
<div class="ft">
[% opaccredits %]
</div>
[% END %]
</div>
[% IF ( opaclanguagesdisplay || OpacKohaUrl ) %]
[% IF ( languages_loop && opaclanguagesdisplay ) %]
[% UNLESS ( one_language_enabled ) %]
<div id="changelanguage" class="ft">
<div class="lang" style="float:left;padding: 0.1em 0;"><strong>Languages:&nbsp;</strong></div>
<ul id="i18nMenu" class="footermenu">
[% FOREACH languages_loo IN languages_loop %]
[% IF ( languages_loo.group_enabled ) %]
[% IF ( languages_loo.plural ) %]
<li class="more" style="float:left;"><a class="sublangs" id="show[% languages_loo.rfc4646_subtag %]" href="#">[% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]</a><div id="sub[% languages_loo.rfc4646_subtag %]">
<div class="bd"><ul>
[% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
[% IF ( sublanguages_loo.enabled ) %]
[% IF ( sublanguages_loo.sublanguage_current ) %]
<li> [% sublanguages_loo.native_description %] [% sublanguages_loo.script_description %] [% sublanguages_loo.region_description %] [% sublanguages_loo.variant_description %] ([% sublanguages_loo.rfc4646_subtag %])</li>
[% ELSE %]
<li><a href="/cgi-bin/koha/changelanguage.pl?language=[% sublanguages_loo.rfc4646_subtag %]"> [% sublanguages_loo.native_description %] [% sublanguages_loo.script_description %] [% sublanguages_loo.region_description %] [% sublanguages_loo.variant_description %] ([% sublanguages_loo.rfc4646_subtag %])</a></li>
[% END %]
[% END %]
[% END %]
</ul></div></div></li>
[% ELSE %]
[% IF ( languages_loo.group_enabled ) %]
[% IF ( languages_loo.current ) %]
<li style="float:left;">[% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]</li>
[% ELSE %]
<li style="float:left;"><a href="/cgi-bin/koha/changelanguage.pl?language=[% languages_loo.rfc4646_subtag %]">[% IF ( languages_loo.native_description ) %][% languages_loo.native_description %][% ELSE %][% languages_loo.rfc4646_subtag %][% END %]</a></li>
[% END %]
[% END %]
[% END %]
[% END %]
[% END %]
</ul>
</div>
[% END %]
[% END %]
[% IF ( OpacKohaUrl ) %]
<span class="koha_url">
Powered by <strong>
[% IF template.name.match('opac-main.tt') %]
<a class="koha_url" href="http://koha-community.org">Koha</a>
[% ELSE %]
<a class="koha_url" rel="nofollow" href="http://koha-community.org">Koha</a>
[% END %]
</strong>&nbsp;&nbsp;
</span>
[% END %]
[% END %]
[% IF persona %]
<script src="https://login.persona.org/include.js"></script>
<script type="text/javascript" language="javascript">
navigator.id.watch({
loggedInUser: [% IF emailaddress %]'[% emailaddress %]'[% ELSE %]null[% END %],
onlogin: function (assertion) {
$.post('/cgi-bin/koha/svc/login',
{ assertion: assertion },
function (data) {
window.location = '/cgi-bin/koha/opac-user.pl';
}
);
},
onlogout: function () {
window.location = '/cgi-bin/koha/opac-main.pl?logout.x=1';
}
});
var signinLink = document.getElementById('browserid');
if (signinLink) {
signinLink.onclick = function(evt) {
// Requests a signed identity assertion from the user.
navigator.id.request({
siteName: "[% LibraryName | html %]",
returnTo: '/cgi-bin/koha/opac-user.pl',
oncancel: function() { alert('user refuses to share identity.'); }
});
};
}
</script>
[% END %]
</body>
</html>