|
Lines 214-222
sub get_template_and_user {
Link Here
|
| 214 |
if ( C4::Context->preference('AutoSelfCheckAllowed') && $in->{template_name} =~ m|sco/| ) { |
214 |
if ( C4::Context->preference('AutoSelfCheckAllowed') && $in->{template_name} =~ m|sco/| ) { |
| 215 |
my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); |
215 |
my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); |
| 216 |
my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass'); |
216 |
my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass'); |
| 217 |
$in->{query}->param( -name => 'login_userid', -values => [$AutoSelfCheckID] ); |
217 |
|
| 218 |
$in->{query}->param( -name => 'login_password', -values => [$AutoSelfCheckPass] ); |
218 |
my $sco_branch = $in->{query}->param('branch'); |
| 219 |
$in->{query}->param( -name => 'koha_login_context', -values => ['sco'] ); |
219 |
if ($sco_branch) { |
|
|
220 |
$AutoSelfCheckID .= $sco_branch; |
| 221 |
} |
| 222 |
my $sco_cookie = $in->{query}->cookie("CGISESSID"); |
| 223 |
my $sco_already_authenticated; |
| 224 |
if ($sco_cookie) { |
| 225 |
my $sco_session = get_session($sco_cookie); |
| 226 |
if ($sco_session) { |
| 227 |
my $is_sco_user = $sco_session->param('sco_user'); |
| 228 |
if ($is_sco_user) { |
| 229 |
$sco_already_authenticated = 1; |
| 230 |
} |
| 231 |
} |
| 232 |
} |
| 233 |
if ( $sco_branch || ( !$sco_already_authenticated ) ) { |
| 234 |
$in->{query}->param( -name => 'login_userid', -values => [$AutoSelfCheckID] ); |
| 235 |
$in->{query}->param( -name => 'login_password', -values => [$AutoSelfCheckPass] ); |
| 236 |
$in->{query}->param( -name => 'koha_login_context', -values => ['sco'] ); |
| 237 |
} |
| 220 |
} else { |
238 |
} else { |
| 221 |
my $request_method = $in->{query}->request_method // q{}; |
239 |
my $request_method = $in->{query}->request_method // q{}; |
| 222 |
unless ( $request_method eq 'POST' && $in->{query}->param('op') eq 'cud-login' ) { |
240 |
unless ( $request_method eq 'POST' && $in->{query}->param('op') eq 'cud-login' ) { |
|
Lines 271-283
sub get_template_and_user {
Link Here
|
| 271 |
if ( |
289 |
if ( |
| 272 |
# If the user logged in is the SCO user and they try to go out of the SCO module, |
290 |
# If the user logged in is the SCO user and they try to go out of the SCO module, |
| 273 |
# log the user out removing the CGISESSID cookie |
291 |
# log the user out removing the CGISESSID cookie |
| 274 |
$in->{template_name} !~ m|sco/| |
292 |
$in->{template_name} !~ m|sco/| && $in->{template_name} !~ m|errors/errorpage.tt| && ($is_sco_user) |
| 275 |
&& $in->{template_name} !~ m|errors/errorpage.tt| |
|
|
| 276 |
&& ( |
| 277 |
$is_sco_user |
| 278 |
|| ( C4::Context->preference('AutoSelfCheckID') |
| 279 |
&& $user eq C4::Context->preference('AutoSelfCheckID') ) |
| 280 |
) |
| 281 |
) |
293 |
) |
| 282 |
{ |
294 |
{ |
| 283 |
$kick_out = 1; |
295 |
$kick_out = 1; |
|
Lines 1166-1175
sub checkauth {
Link Here
|
| 1166 |
} else { |
1178 |
} else { |
| 1167 |
my $retuserid; |
1179 |
my $retuserid; |
| 1168 |
|
1180 |
|
|
|
1181 |
#Support multi-branch AutoSelfCheckID |
| 1182 |
my $sco_multi; |
| 1183 |
my $sco_multi_branch = $query->param('branch'); |
| 1184 |
if ($sco_multi_branch) { |
| 1185 |
|
| 1186 |
#Validate that the branch belongs to a real library |
| 1187 |
my $sco_library = Koha::Libraries->find($sco_multi_branch); |
| 1188 |
if ($sco_library) { |
| 1189 |
my $sco_syspref = C4::Context->preference('AutoSelfCheckID'); |
| 1190 |
if ($sco_syspref) { |
| 1191 |
if ( $q_userid eq ( $sco_syspref . $sco_multi_branch ) ) { |
| 1192 |
$sco_multi = 1; |
| 1193 |
} |
| 1194 |
} |
| 1195 |
} |
| 1196 |
} |
| 1197 |
|
| 1198 |
#/Support multi-branch AutoSelfCheckID |
| 1199 |
|
| 1169 |
if ( |
1200 |
if ( |
| 1170 |
$request_method eq 'POST' |
1201 |
$request_method eq 'POST' |
| 1171 |
|| ( C4::Context->preference('AutoSelfCheckID') |
1202 |
|| ( C4::Context->preference('AutoSelfCheckID') |
| 1172 |
&& $q_userid eq C4::Context->preference('AutoSelfCheckID') ) |
1203 |
&& $q_userid eq C4::Context->preference('AutoSelfCheckID') ) |
|
|
1204 |
|| ($sco_multi) |
| 1173 |
) |
1205 |
) |
| 1174 |
{ |
1206 |
{ |
| 1175 |
my $patron; |
1207 |
my $patron; |
| 1176 |
- |
|
|