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

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

Return to bug 18144