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

(-)a/C4/Auth.pm (-2 / +26 lines)
Lines 748-753 sub checkauth { Link Here
748
    my $authnotrequired = shift;
748
    my $authnotrequired = shift;
749
    my $flagsrequired   = shift;
749
    my $flagsrequired   = shift;
750
    my $type            = shift;
750
    my $type            = shift;
751
    my $emailaddress    = shift;
751
    $type = 'opac' unless $type;
752
    $type = 'opac' unless $type;
752
753
753
    my $dbh     = C4::Context->dbh;
754
    my $dbh     = C4::Context->dbh;
Lines 788-793 sub checkauth { Link Here
788
        );
789
        );
789
        $loggedin = 1;
790
        $loggedin = 1;
790
    }
791
    }
792
    elsif ( $emailaddress) {
793
        # the Google OpenID Connect passes an email address
794
    }
791
    elsif ( $sessionID = $query->cookie("CGISESSID") )
795
    elsif ( $sessionID = $query->cookie("CGISESSID") )
792
    {    # assignment, not comparison
796
    {    # assignment, not comparison
793
        my $session = get_session($sessionID);
797
        my $session = get_session($sessionID);
Lines 924-930 sub checkauth { Link Here
924
        if ( ( $cas && $query->param('ticket') )
928
        if ( ( $cas && $query->param('ticket') )
925
            || $q_userid
929
            || $q_userid
926
            || ( $shib && $shib_login )
930
            || ( $shib && $shib_login )
927
            || $pki_field ne 'None' )
931
            || $pki_field ne 'None'
932
            || $emailaddress )
928
        {
933
        {
929
            my $password    = $query->param('password');
934
            my $password    = $query->param('password');
930
            my $shibSuccess = 0;
935
            my $shibSuccess = 0;
Lines 952-957 sub checkauth { Link Here
952
                    $info{'invalidCasLogin'} = 1 unless ($return);
957
                    $info{'invalidCasLogin'} = 1 unless ($return);
953
                }
958
                }
954
959
960
                elsif ( $emailaddress ) {
961
                    my $value = $emailaddress;
962
963
                    # If we're looking up the email, there's a chance that the person
964
                    # doesn't have a userid. So if there is none, we pass along the
965
                    # borrower number, and the bits of code that need to know the user
966
                    # ID will have to be smart enough to handle that.
967
                    require C4::Members;
968
                    my @users_info = C4::Members::GetBorrowersWithEmail($value);
969
                    if (@users_info) {
970
971
                        # First the userid, then the borrowernum
972
                        $value = $users_info[0][1] || $users_info[0][0];
973
                    } else {
974
                        undef $value;
975
                    }
976
                    $return = $value ? 1 : 0;
977
                    $userid = $value;
978
                }
979
955
                elsif (
980
                elsif (
956
                    ( $pki_field eq 'Common Name' && $ENV{'SSL_CLIENT_S_DN_CN'} )
981
                    ( $pki_field eq 'Common Name' && $ENV{'SSL_CLIENT_S_DN_CN'} )
957
                    || ( $pki_field eq 'emailAddress'
982
                    || ( $pki_field eq 'emailAddress'
958
- 

Return to bug 18144