Bug 36349: Fix AutoSelfCheckAllowed
Move the check to C4::Auth. Yes, it's not nice, I didn't expect to add exception to this code, and it's adding more ugly code to get_template_and_user, but... Suggestions welcome! Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
5300bcd574
commit
5c634ee597
18
C4/Auth.pm
18
C4/Auth.pm
|
|
@ -183,11 +183,19 @@ sub get_template_and_user {
|
|||
$in->{'query'},
|
||||
);
|
||||
|
||||
my $request_method = $in->{query}->request_method // q{};
|
||||
unless ( $request_method eq 'POST' && $in->{query}->param('op') eq 'cud-login' ) {
|
||||
for my $v ( qw( login_userid login_password ) ) {
|
||||
$in->{query}->param($v, '')
|
||||
if $in->{query}->param($v);
|
||||
if ( C4::Context->preference('AutoSelfCheckAllowed') && $in->{template_name} =~ m|sco/| ) {
|
||||
my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
|
||||
my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');
|
||||
$in->{query}->param( -name => 'login_userid', -values => [$AutoSelfCheckID] );
|
||||
$in->{query}->param( -name => 'login_password', -values => [$AutoSelfCheckPass] );
|
||||
$in->{query}->param( -name => 'koha_login_context', -values => ['sco'] );
|
||||
} else {
|
||||
my $request_method = $in->{query}->request_method // q{};
|
||||
unless ( $request_method eq 'POST' && $in->{query}->param('op') eq 'cud-login' ) {
|
||||
for my $v (qw( login_userid login_password )) {
|
||||
$in->{query}->param( $v, '' )
|
||||
if $in->{query}->param($v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,14 +61,6 @@ unless ( in_iprange(C4::Context->preference('SelfCheckAllowByIPRanges')) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (C4::Context->preference('AutoSelfCheckAllowed'))
|
||||
{
|
||||
my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
|
||||
my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');
|
||||
$query->param(-name=>'userid',-values=>[$AutoSelfCheckID]);
|
||||
$query->param(-name=>'password',-values=>[$AutoSelfCheckPass]);
|
||||
$query->param(-name=>'koha_login_context',-values=>['sco']);
|
||||
}
|
||||
$query->param(-name=>'sco_user_login',-values=>[1]);
|
||||
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
|
|
|
|||
Loading…
Reference in New Issue