View | Details | Raw Unified | Return to bug 17486
Collapse All | Expand All

(-)a/C4/Auth.pm (-36 / +3 lines)
Lines 423-429 sub get_template_and_user { Link Here
423
        LoginFirstname  => ( C4::Context->userenv ? C4::Context->userenv->{"firstname"} : "Bel" ),
423
        LoginFirstname  => ( C4::Context->userenv ? C4::Context->userenv->{"firstname"} : "Bel" ),
424
        LoginSurname    => C4::Context->userenv ? C4::Context->userenv->{"surname"}      : "Inconnu",
424
        LoginSurname    => C4::Context->userenv ? C4::Context->userenv->{"surname"}      : "Inconnu",
425
        emailaddress    => C4::Context->userenv ? C4::Context->userenv->{"emailaddress"} : undef,
425
        emailaddress    => C4::Context->userenv ? C4::Context->userenv->{"emailaddress"} : undef,
426
        loggedinpersona => C4::Context->userenv ? C4::Context->userenv->{"persona"}      : undef,
427
        TagsEnabled     => C4::Context->preference("TagsEnabled"),
426
        TagsEnabled     => C4::Context->preference("TagsEnabled"),
428
        hide_marc       => C4::Context->preference("hide_marc"),
427
        hide_marc       => C4::Context->preference("hide_marc"),
429
        item_level_itypes  => C4::Context->preference('item-level_itypes'),
428
        item_level_itypes  => C4::Context->preference('item-level_itypes'),
Lines 434-440 sub get_template_and_user { Link Here
434
        using_https        => $using_https,
433
        using_https        => $using_https,
435
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
434
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
436
        marcflavour        => C4::Context->preference("marcflavour"),
435
        marcflavour        => C4::Context->preference("marcflavour"),
437
        persona            => C4::Context->preference("persona"),
438
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
436
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
439
    );
437
    );
440
    if ( $in->{'type'} eq "intranet" ) {
438
    if ( $in->{'type'} eq "intranet" ) {
Lines 748-754 sub checkauth { Link Here
748
    my $authnotrequired = shift;
746
    my $authnotrequired = shift;
749
    my $flagsrequired   = shift;
747
    my $flagsrequired   = shift;
750
    my $type            = shift;
748
    my $type            = shift;
751
    my $persona         = shift;
752
    $type = 'opac' unless $type;
749
    $type = 'opac' unless $type;
753
750
754
    my $dbh     = C4::Context->dbh;
751
    my $dbh     = C4::Context->dbh;
Lines 789-798 sub checkauth { Link Here
789
        );
786
        );
790
        $loggedin = 1;
787
        $loggedin = 1;
791
    }
788
    }
792
    elsif ($persona) {
793
794
        # we don't want to set a session because we are being called by a persona callback
795
    }
796
    elsif ( $sessionID = $query->cookie("CGISESSID") )
789
    elsif ( $sessionID = $query->cookie("CGISESSID") )
797
    {    # assignment, not comparison
790
    {    # assignment, not comparison
798
        my $session = get_session($sessionID);
791
        my $session = get_session($sessionID);
Lines 807-813 sub checkauth { Link Here
807
                $session->param('surname'),      $session->param('branch'),
800
                $session->param('surname'),      $session->param('branch'),
808
                $session->param('branchname'),   $session->param('flags'),
801
                $session->param('branchname'),   $session->param('flags'),
809
                $session->param('emailaddress'), $session->param('branchprinter'),
802
                $session->param('emailaddress'), $session->param('branchprinter'),
810
                $session->param('persona'),      $session->param('shibboleth')
803
                $session->param('shibboleth')
811
            );
804
            );
812
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
805
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
813
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
806
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
Lines 930-937 sub checkauth { Link Here
930
        if ( ( $cas && $query->param('ticket') )
923
        if ( ( $cas && $query->param('ticket') )
931
            || $userid
924
            || $userid
932
            || ( $shib && $shib_login )
925
            || ( $shib && $shib_login )
933
            || $pki_field ne 'None'
926
            || $pki_field ne 'None' )
934
            || $persona )
935
        {
927
        {
936
            my $password    = $query->param('password');
928
            my $password    = $query->param('password');
937
            my $shibSuccess = 0;
929
            my $shibSuccess = 0;
Lines 959-985 sub checkauth { Link Here
959
                    $info{'invalidCasLogin'} = 1 unless ($return);
951
                    $info{'invalidCasLogin'} = 1 unless ($return);
960
                }
952
                }
961
953
962
                elsif ($persona) {
963
                    my $value = $persona;
964
965
                    # If we're looking up the email, there's a chance that the person
966
                    # doesn't have a userid. So if there is none, we pass along the
967
                    # borrower number, and the bits of code that need to know the user
968
                    # ID will have to be smart enough to handle that.
969
                    require C4::Members;
970
                    my @users_info = C4::Members::GetBorrowersWithEmail($value);
971
                    if (@users_info) {
972
973
                        # First the userid, then the borrowernum
974
                        $value = $users_info[0][1] || $users_info[0][0];
975
                    }
976
                    else {
977
                        undef $value;
978
                    }
979
                    $return = $value ? 1 : 0;
980
                    $userid = $value;
981
                }
982
983
                elsif (
954
                elsif (
984
                    ( $pki_field eq 'Common Name' && $ENV{'SSL_CLIENT_S_DN_CN'} )
955
                    ( $pki_field eq 'Common Name' && $ENV{'SSL_CLIENT_S_DN_CN'} )
985
                    || ( $pki_field eq 'emailAddress'
956
                    || ( $pki_field eq 'emailAddress'
Lines 1132-1147 sub checkauth { Link Here
1132
                    $session->param( 'ip',           $session->remote_addr() );
1103
                    $session->param( 'ip',           $session->remote_addr() );
1133
                    $session->param( 'lasttime',     time() );
1104
                    $session->param( 'lasttime',     time() );
1134
                }
1105
                }
1135
                if ($persona) {
1136
                    $session->param( 'persona', 1 );
1137
                }
1138
                C4::Context->set_userenv(
1106
                C4::Context->set_userenv(
1139
                    $session->param('number'),       $session->param('id'),
1107
                    $session->param('number'),       $session->param('id'),
1140
                    $session->param('cardnumber'),   $session->param('firstname'),
1108
                    $session->param('cardnumber'),   $session->param('firstname'),
1141
                    $session->param('surname'),      $session->param('branch'),
1109
                    $session->param('surname'),      $session->param('branch'),
1142
                    $session->param('branchname'),   $session->param('flags'),
1110
                    $session->param('branchname'),   $session->param('flags'),
1143
                    $session->param('emailaddress'), $session->param('branchprinter'),
1111
                    $session->param('emailaddress'), $session->param('branchprinter'),
1144
                    $session->param('persona'),      $session->param('shibboleth')
1112
                    $session->param('shibboleth')
1145
                );
1113
                );
1146
1114
1147
            }
1115
            }
Lines 1254-1260 sub checkauth { Link Here
1254
        wrongip                               => $info{'wrongip'},
1222
        wrongip                               => $info{'wrongip'},
1255
        PatronSelfRegistration                => C4::Context->preference("PatronSelfRegistration"),
1223
        PatronSelfRegistration                => C4::Context->preference("PatronSelfRegistration"),
1256
        PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"),
1224
        PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"),
1257
        persona                               => C4::Context->preference("Persona"),
1258
        opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
1225
        opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
1259
    );
1226
    );
1260
1227
(-)a/C4/Context.pm (-3 / +2 lines)
Lines 847-853 sub userenv { Link Here
847
  C4::Context->set_userenv($usernum, $userid, $usercnum,
847
  C4::Context->set_userenv($usernum, $userid, $usercnum,
848
                           $userfirstname, $usersurname,
848
                           $userfirstname, $usersurname,
849
                           $userbranch, $branchname, $userflags,
849
                           $userbranch, $branchname, $userflags,
850
                           $emailaddress, $branchprinter, $persona);
850
                           $emailaddress, $branchprinter);
851
851
852
Establish a hash of user environment variables.
852
Establish a hash of user environment variables.
853
853
Lines 858-864 set_userenv is called in Auth.pm Link Here
858
#'
858
#'
859
sub set_userenv {
859
sub set_userenv {
860
    shift @_;
860
    shift @_;
861
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona, $shibboleth)=
861
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $shibboleth)=
862
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
862
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
863
    @_;
863
    @_;
864
    my $var=$context->{"activeuser"} || '';
864
    my $var=$context->{"activeuser"} || '';
Lines 874-880 sub set_userenv { Link Here
874
        "flags"      => $userflags,
874
        "flags"      => $userflags,
875
        "emailaddress"     => $emailaddress,
875
        "emailaddress"     => $emailaddress,
876
        "branchprinter"    => $branchprinter,
876
        "branchprinter"    => $branchprinter,
877
        "persona"    => $persona,
878
        "shibboleth" => $shibboleth,
877
        "shibboleth" => $shibboleth,
879
    };
878
    };
880
    $context->{userenv}->{$var} = $cell;
879
    $context->{userenv}->{$var} = $cell;
(-)a/installer/data/mysql/atomicupdate/bug_17486.sql (+1 lines)
Line 0 Link Here
1
DELETE FROM systempreferences WHERE variable="Persona";
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 409-415 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
409
('PayPalSandboxMode',  '1', NULL ,  'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.',  'YesNo'),
409
('PayPalSandboxMode',  '1', NULL ,  'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.',  'YesNo'),
410
('PayPalSignature',  '', NULL ,  'Your PayPal API signature',  'Free'),
410
('PayPalSignature',  '', NULL ,  'Your PayPal API signature',  'Free'),
411
('PayPalUser',  '', NULL ,  'Your PayPal API username ( email address )',  'Free'),
411
('PayPalUser',  '', NULL ,  'Your PayPal API username ( email address )',  'Free'),
412
('Persona','0','','Use Mozilla Persona for login','YesNo'),
413
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
412
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
414
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
413
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
415
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
414
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (-8 lines)
Lines 156-169 Administration: Link Here
156
            - "Google OpenID Connect Restrict to domain (or subdomain of this domain): "
156
            - "Google OpenID Connect Restrict to domain (or subdomain of this domain): "
157
            - pref: GoogleOpenIDConnectDomain
157
            - pref: GoogleOpenIDConnectDomain
158
            - Leave blank for all google domains
158
            - Leave blank for all google domains
159
    Mozilla Persona:
160
        -
161
            - "Allow Mozilla persona for login: "
162
            - pref: Persona
163
              default: 0
164
              choices:
165
                  yes: "Yes"
166
                  no: "No"
167
    Share anonymous usage statistics:
159
    Share anonymous usage statistics:
168
        -
160
        -
169
            - "Share anonymous Koha usage data with the Koha community: "
161
            - "Share anonymous Koha usage data with the Koha community: "
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/persona-buttons.css (-232 lines)
Lines 1-232 Link Here
1
/* Link body */
2
a.persona-button {
3
  color : #FFF;
4
}
5
6
.persona-button{
7
  color: #fff;
8
  display: inline-block;
9
  font-size: 14px;
10
  font-family: Helvetica, Arial, sans-serif;
11
  font-weight: bold;
12
  line-height: 1.1;
13
  overflow: hidden;
14
  position: relative;
15
  text-decoration: none;
16
  text-shadow: 0 1px rgba(0,0,0,0.5), 0 0 2px rgba(0,0,0,0.2);
17
18
  background: #297dc3;
19
  background: -moz-linear-gradient(top, #43a6e2, #287cc2);
20
  background: -ms-linear-gradient(top, #43a6e2, #287cc2);
21
  background: -o-linear-gradient(top, #43a6e2, #287cc2);
22
  background: -webkit-linear-gradient(top, #43a6e2, #287cc2);
23
  background: linear-gradient(to bottom, #43a6e2 0%,#287cc2 100%); /* W3C */
24
25
  -moz-border-radius:   3px;
26
  -ms-border-radius:     3px;
27
  -o-border-radius:     3px;
28
  -webkit-border-radius:   3px;
29
  border-radius:       3px;
30
31
  -moz-box-shadow:   0 1px 0 rgba(0,0,0,0.2);
32
  -ms-box-shadow:   0 1px 0 rgba(0,0,0,0.2);
33
  -o-box-shadow:     0 1px 0 rgba(0,0,0,0.2);
34
  -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.2);
35
  box-shadow:     0 1px 0 rgba(0,0,0,0.2);
36
}
37
38
.persona-button:hover{
39
  background: #21669f;
40
  background: -moz-linear-gradient(top, #3788b9, #21669f);
41
  background: -ms-linear-gradient(top, #3788b9, #21669f);
42
  background: -o-linear-gradient(top, #3788b9, #21669f);
43
  background: -webkit-linear-gradient(top, #3788b9, #21669f);
44
  background: linear-gradient(to bottom, #3788b9 0%,#21669f 100%); /* W3C */
45
}
46
47
.persona-button:active, .persona-button:focus{
48
  top: 1px;
49
  -moz-box-shadow:   none;
50
  -ms-box-shadow:   none;
51
  -o-box-shadow:     none;
52
  -webkit-box-shadow: none;
53
  box-shadow:     none;
54
}
55
56
.persona-button span{
57
  display: inline-block;
58
  padding: 5px 10px 5px 40px;
59
}
60
61
/* Icon */
62
.persona-button span:after{
63
  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAA4klEQVR42o2RWaqEMBRE3YaCiDjPwQGcd9CrysLv4wTyoLFD90dxqbp1EgdPRB7Kskznea6Zn/aPoKoqUUrJOI5m4l2QBfSyLHKep1zXZSae3An1fS/7vst931bGkzuhaZrsLVbGkzuheZ7lOI6HyJ2QUkqv6yrbtv0LT+6E7G0UrfBfP3lZlpoXH4ZBmHgn5Pv+KwxDfqp0XQdgJp6c/RsUBIGOokiSJDE/s21bACbe5Ozp0TdAHMdSFIXUdS1N01C2wpObPT36HifwCJzI0iX29Oh7XP0E3CB9L01TzM+i/wePv4ZE5RtAngAAAABJRU5ErkJggg==) 10px center no-repeat;
64
  content: '';
65
  display: block;
66
  width: 31px;
67
68
  position: absolute;
69
  bottom: 0;
70
  left: -3px;
71
  top: 0;
72
  z-index: 10;
73
}
74
75
/*  Icon background */
76
.persona-button span:before{
77
  content: '';
78
  display: block;
79
  height: 100%;
80
  width: 20px;
81
82
  position: absolute;
83
  bottom: 0;
84
  left: 0;
85
  top: 0;
86
  z-index: 1;
87
88
  background: #42a9dd;
89
  background: -moz-linear-gradient(top, #50b8e8, #3095ce);
90
  background: -ms-linear-gradient(top, #50b8e8, #3095ce);
91
  background: -o-linear-gradient(top, #50b8e8, #3095ce);
92
  background: -webkit-linear-gradient(top, #50b8e8, #3095ce);
93
  background: linear-gradient(to bottom, #50b8e8 0%,#3095ce 100%); /* W3C */
94
95
  -moz-border-radius:   3px 0 0 3px;
96
  -ms-border-radius:     3px 0 0 3px;
97
  -o-border-radius:     3px 0 0 3px;
98
  -webkit-border-radius:   3px 0 0 3px;
99
  border-radius:       3px 0 0 3px;
100
}
101
102
/* Triangle */
103
.persona-button:before{
104
  background: #42a9dd;
105
  content: '';
106
  display: block;
107
  height: 26px;
108
  width: 26px;
109
110
  position: absolute;
111
  left: 2px;
112
  top: 50%;
113
  margin-top: -13px;
114
  z-index: 0;
115
116
  background: -moz-linear-gradient(-45deg, #50b8e8, #3095ce);
117
  background: -ms-linear-gradient(-45deg, #50b8e8, #3095ce);
118
  background: -o-linear-gradient(-45deg, #50b8e8, #3095ce);
119
  background: -webkit-linear-gradient(-45deg, #50b8e8, #3095ce);
120
  background: linear-gradient(to bottom, #50b8e8 0%,#3095ce 100%); /* W3C */
121
122
  -moz-box-shadow:   1px -1px 1px rgba(0,0,0,0.1);
123
  -ms-box-shadow:   1px -1px 1px rgba(0,0,0,0.1);
124
  -o-box-shadow:     1px -1px 1px rgba(0,0,0,0.1);
125
  -webkit-box-shadow: 1px -1px 1px rgba(0,0,0,0.1);
126
  box-shadow:     1px -1px 1px rgba(0,0,0,0.1);
127
128
  -moz-transform:   rotate(45deg);
129
  -ms-transform:     rotate(45deg);
130
  -o-transform:     rotate(45deg);
131
  -webkit-transform:   rotate(45deg);
132
  transform:       rotate(45deg);
133
}
134
135
/* Inset shadow (required here because the icon background clips it when on the `a` element) */
136
.persona-button:after{
137
  content: '';
138
  display: block;
139
  height: 100%;
140
  width: 100%;
141
142
  position: absolute;
143
  left: 0;
144
  top: 0;
145
  bottom: 0;
146
  right: 0;
147
  z-index: 10;
148
149
  -moz-border-radius:   3px;
150
  -ms-border-radius:     3px;
151
  -o-border-radius:     3px;
152
  -webkit-border-radius:   3px;
153
  border-radius:       3px;
154
155
  -moz-box-shadow:   inset 0 -1px 0 rgba(0,0,0,0.3);
156
  -ms-box-shadow:   inset 0 -1px 0 rgba(0,0,0,0.3);
157
  -o-box-shadow:     inset 0 -1px 0 rgba(0,0,0,0.3);
158
  -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3);
159
  box-shadow:     inset 0 -1px 0 rgba(0,0,0,0.3);
160
}
161
162
/* ========================================================
163
 *    Dark button
164
 * ===================================================== */
165
.persona-button.dark{
166
  background: #3c3c3c;
167
  background: -moz-linear-gradient(top, #606060, #3c3c3c);
168
  background: -ms-linear-gradient(top, #606060, #3c3c3c);
169
  background: -o-linear-gradient(top, #606060, #3c3c3c);
170
  background: -webkit-linear-gradient(top, #606060, #3c3c3c);
171
  background: linear-gradient(top, #606060, #3c3c3c);
172
}
173
.persona-button.dark:hover{
174
  background: #2d2d2d;
175
  background: -moz-linear-gradient(top, #484848, #2d2d2d);
176
  background: -ms-linear-gradient(top, #484848, #2d2d2d);
177
  background: -o-linear-gradient(top, #484848, #2d2d2d);
178
  background: -webkit-linear-gradient(top, #484848, #2d2d2d);
179
  background: linear-gradient(top, #484848, #2d2d2d);
180
}
181
.persona-button.dark span:before{ /* Icon BG */
182
  background: #d34f2d;
183
  background: -moz-linear-gradient(top, #ebac45, #d34f2d);
184
  background: -ms-linear-gradient(top, #ebac45, #d34f2d);
185
  background: -o-linear-gradient(top, #ebac45, #d34f2d);
186
  background: -webkit-linear-gradient(top, #ebac45, #d34f2d);
187
  background: linear-gradient(top, #ebac45, #d34f2d);
188
}
189
.persona-button.dark:before{ /* Triangle */
190
  background: #d34f2d;
191
  background: -moz-linear-gradient(-45deg, #ebac45, #d34f2d);
192
  background: -ms-linear-gradient(-45deg, #ebac45, #d34f2d);
193
  background: -o-linear-gradient(-45deg, #ebac45, #d34f2d);
194
  background: -webkit-linear-gradient(-45deg, #ebac45, #d34f2d);
195
  background: linear-gradient(-45deg, #d34f2d, #ebac45); /* flipped for updated spec */
196
}
197
198
/* ========================================================
199
 *    Orange button
200
 * ===================================================== */
201
.persona-button.orange{
202
  background: #ee731a;
203
  background: -moz-linear-gradient(top, #ee731a, #d03116);
204
  background: -ms-linear-gradient(top, #ee731a, #d03116);
205
  background: -o-linear-gradient(top, #ee731a, #d03116);
206
  background: -webkit-linear-gradient(top, #ee731a, #d03116);
207
  background: linear-gradient(top, #ee731a, #d03116);
208
}
209
.persona-button.orange:hover{
210
  background: #cb6216;
211
  background: -moz-linear-gradient(top, #cb6216, #b12a13);
212
  background: -ms-linear-gradient(top, #cb6216, #b12a13);
213
  background: -o-linear-gradient(top, #cb6216, #b12a13);
214
  background: -webkit-linear-gradient(top, #cb6216, #b12a13);
215
  background: linear-gradient(top, #cb6216, #b12a13);
216
}
217
.persona-button.orange span:before{ /* Icon BG */
218
  background: #e84a21;
219
  background: -moz-linear-gradient(top, #f7ad27, #e84a21);
220
  background: -ms-linear-gradient(top, #f7ad27, #e84a21);
221
  background: -o-linear-gradient(top, #f7ad27, #e84a21);
222
  background: -webkit-linear-gradient(top, #f7ad27, #e84a21);
223
  background: linear-gradient(top, #f7ad27, #e84a21);
224
}
225
.persona-button.orange:before{ /* Triangle */
226
  background: #e84a21;
227
  background: -moz-linear-gradient(-45deg, #f7ad27, #e84a21);
228
  background: -ms-linear-gradient(-45deg, #f7ad27, #e84a21);
229
  background: -o-linear-gradient(-45deg, #f7ad27, #e84a21);
230
  background: -webkit-linear-gradient(-45deg, #f7ad27, #e84a21);
231
  background: linear-gradient(-45deg, #e84a21, #f7ad27); /* flipped for updated spec */
232
}
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc (-3 lines)
Lines 31-39 Link Here
31
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/[% opac_css_override %]" />
31
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/[% opac_css_override %]" />
32
[% END %]
32
[% END %]
33
<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" />
33
<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" />
34
[% IF persona %]
35
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/persona-buttons.css" />
36
[% END %]
37
[% IF ( bidi ) %]
34
[% IF ( bidi ) %]
38
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/right-to-left.css" />
35
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/right-to-left.css" />
39
[% END %]
36
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-5 / +1 lines)
Lines 109-119 Link Here
109
                                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
109
                                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
110
                                    [% IF ( loggedinusername ) %]
110
                                    [% IF ( loggedinusername ) %]
111
                                        <li><p class="navbar-text">
111
                                        <li><p class="navbar-text">
112
                                            [% IF persona %]
112
                                            <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
113
                                                <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1" onclick='navigator.id.logout();'>
114
                                            [% ELSE %]
115
                                                <a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
116
                                            [% END %]
117
                                            Log out</a></p></li>
113
                                            Log out</a></p></li>
118
                                    [% END %]
114
                                    [% END %]
119
                                [% END %]
115
                                [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (-37 lines)
Lines 229-271 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
229
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
229
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
230
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/googleindictransliteration.js"></script>
230
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/googleindictransliteration.js"></script>
231
[% END %]
231
[% END %]
232
[% IF persona %]
233
    <script src="https://login.persona.org/include.js"></script>
234
    <script type="text/javascript">
235
236
    navigator.id.watch({
237
        loggedInUser: [% IF emailaddress && loggedinpersona %]'[% emailaddress %]'[% ELSE %]null[% END %],
238
        onlogin: function (assertion) {
239
            $.post('/cgi-bin/koha/svc/login',
240
                { assertion: assertion },
241
                function (data) {
242
                    window.location = '/cgi-bin/koha/opac-user.pl';
243
                }
244
            )
245
            .fail(function() { var errstr = _("Could not login, perhaps your Persona email does not match your Koha one");
246
                alert(errstr);
247
            });
248
        },
249
        onlogout: function () {
250
            window.location = '/cgi-bin/koha/opac-main.pl?logout.x=1';
251
        }
252
    });
253
254
    var signinLink = document.getElementById('browserid');
255
256
    if (signinLink) {
257
        signinLink.onclick = function(evt) {
258
            // Requests a signed identity assertion from the user.
259
            navigator.id.request({
260
                siteName: "[% LibraryName | html %]",
261
                returnTo: '/cgi-bin/koha/opac-user.pl',
262
                oncancel: function() { alert('user refuses to share identity.'); }
263
                });
264
            };
265
    }
266
267
    </script>
268
[% END #  / IF persona %]
269
232
270
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
233
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
271
<script type="text/javascript">
234
<script type="text/javascript">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt (-4 lines)
Lines 191-200 Link Here
191
                        </ul>
191
                        </ul>
192
                    [% END # / IF opacuserlogin %]
192
                    [% END # / IF opacuserlogin %]
193
193
194
                    [% IF persona %]
195
                        <p><a href="#" class="persona-button" id="browserid" ><span>Sign in with your Email</span></a></p>
196
                    [% END %]
197
198
                </div> <!-- /.opac-auth -->
194
                </div> <!-- /.opac-auth -->
199
            </div> <!-- /.span12 -->
195
            </div> <!-- /.span12 -->
200
        </div> <!-- /.row-fluid -->
196
        </div> <!-- /.row-fluid -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-3 lines)
Lines 98-106 Link Here
98
                                </form>
98
                                </form>
99
                            </div> <!-- /#login -->
99
                            </div> <!-- /#login -->
100
                        [% END # /casAuthentication %]
100
                        [% END # /casAuthentication %]
101
                        [% IF persona %]
102
                            <a href="#" class="persona-button" id="browserid" ><span>Sign in with your email</span></a>
103
                        [% END # /persona %]
104
                    [% END # / loggedinusername %]
101
                    [% END # / loggedinusername %]
105
                [% END # /opacuserlogin %]
102
                [% END # /opacuserlogin %]
106
                [% IF ( OpacNavRight ) %]
103
                [% IF ( OpacNavRight ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt (-3 lines)
Lines 90-98 Link Here
90
                                            </form>
90
                                            </form>
91
                                        </div> <!-- /#login -->
91
                                        </div> <!-- /#login -->
92
                                    [% END # /casAuthentication %]
92
                                    [% END # /casAuthentication %]
93
                                    [% IF persona %]
94
                                        <a href="#" class="persona-button" id="browserid" ><span>Sign in with your email</span></a>
95
                                    [% END # /persona %]
96
                                [% END # / loggedinusername %]
93
                                [% END # / loggedinusername %]
97
                            [% END # /opacuserlogin %]
94
                            [% END # /opacuserlogin %]
98
                            [% IF ( OpacNavRight ) %]
95
                            [% IF ( OpacNavRight ) %]
(-)a/opac/svc/login (-59 lines)
Lines 1-58 Link Here
1
#!/usr/bin/perl
2
3
# Copyright chris@bigballofwax.co.nz 2013
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use CGI qw ( -utf8 );
21
use strict;
22
use warnings;
23
use C4::Auth;
24
use C4::Context;
25
26
use LWP::UserAgent;
27
use HTTP::Request::Common qw{ POST };
28
use JSON qw( decode_json );
29
30
my $url  = 'https://verifier.login.persona.org/verify';
31
32
my $query = CGI->new();
33
34
my $host = C4::Context->preference('OPACBaseURL');
35
36
my $assertion = $query->param('assertion');
37
38
my $ua = LWP::UserAgent->new();
39
my $response =
40
  $ua->post( $url, [ 'assertion' => $assertion, 'audience' => $host ] );
41
42
if ( $response->is_success ) {
43
    my $content      = $response->decoded_content();
44
    my $decoded_json = decode_json($content);
45
    my ( $userid, $cookie, $sessionID ) =
46
      checkauth( $query, 1,  {}, 'opac', $decoded_json->{'email'} );
47
    if ($userid) { # a valid user has logged in
48
        print $query->header( -cookie => $cookie );
49
        print $decoded_json;
50
    }
51
    else {
52
# logged in with an email that isn't associated with a borrower
53
        die "Email not associated with a borrower";
54
    }
55
}
56
else {
57
    warn $response->status_line, "\n";
58
}
59
- 

Return to bug 17486