diff --git a/C4/Auth.pm b/C4/Auth.pm index 95b271765c..e98b43c2bd 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1560,6 +1560,17 @@ sub checkpw { sub checkpw_internal { my ( $dbh, $userid, $password ) = @_; + if ( $userid && $userid eq C4::Context->config('user') ) { + if ( $password && $password eq C4::Context->config('pass') ) { + # Koha superuser account +# C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"",1); + return 2; + } + else { + return 0; + } + } + my $sth = $dbh->prepare( "select password,cardnumber,borrowernumber,userid,firstname,surname,branchcode,flags from borrowers where userid=?" @@ -1594,14 +1605,6 @@ sub checkpw_internal { return 1, $cardnumber, $userid; } } - if ( $userid && $userid eq C4::Context->config('user') - && "$password" eq C4::Context->config('pass') ) - { - -# Koha superuser account -# C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"",1); - return 2; - } if ( $userid && $userid eq 'demo' && "$password" eq 'demo' && C4::Context->config('demo') ) diff --git a/C4/Members.pm b/C4/Members.pm index 61eb2d9346..33106cf932 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -879,7 +879,8 @@ sub Check_Userid { $dbh->prepare( "SELECT * FROM borrowers WHERE userid=? AND borrowernumber != ?"); $sth->execute( $uid, $member ); - if ( ( $uid ne '' ) && ( my $row = $sth->fetchrow_hashref ) ) { + if ( (( $uid ne '' ) && ( my $row = $sth->fetchrow_hashref )) or + (( $uid ne '' ) && ( $uid eq C4::Context->config('user') )) ) { return 0; } else {