Changeset 98

Show
Ignore:
Timestamp:
08/01/07 20:30:24 (1 year ago)
Author:
pdingle
Message:

moving from Kim's processing code to phpInfocard code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-infocard

    • Property svn:externals set to
      pwlib https://pamelaproject.com/svn/pw/pwcommon/trunk/pwlib
      vendor https://pamelaproject.com/svn/pw/pwcommon/trunk/vendor
      legal https://pamelaproject.com/svn/pw/pwcommon/trunk/legal
  • trunk/wp-infocard/pw-config.php

    r84 r98  
    2626define ('PW_SITEMESGURL', PW_PLUGINURL . '/site-messages/infocard-usermessage.php'); 
    2727define ('PW_SECURESITEURL', get_settings('securesiteurl') ); 
     28define ('PW_PHPINFOCARDPATH', PW_PATH . '/pwlib/vendor/phpInfoCard'); 
    2829 
    2930if ( PW_CUSTOM_DATA)  
  • trunk/wp-infocard/wp/clickback.pw.php

    r61 r98  
    6969        } // end of function verifyChallenge     
    7070 
    71         // Function:  sendAccountValidation 
    72         // Description:  creates & emails a validation message to the user 
    73         // Input:   clickbackID:  pre-created clickback value 
    74         //              user email:  destination email 
    75         // Output:  none 
    76         // Side-effects: sends an email 
     71        /* 
     72                Function:       validateClickback 
     73                Description:    returns true if the supplied candidate matches 
     74                                a newly generated clickback 
     75                Input:          candidate - the clickback value to validate 
     76                                user_email - email address from the token 
     77                                user_ppid - privatepersonalidentifier from the token 
     78                Output:         boolean 
     79                Side Effects:   none 
     80        */ 
     81        function validateClickback($candidate, $user_email, $user_ppid) 
     82        { 
     83                pw_utils::printDebug("&nbsp;Clickback posted<br/>"); 
     84 
     85                $challengeContent = $user_email . $user_ppid; 
     86                $clickbackUrl = pw_clickback::createChallenge($challengeContent); 
     87                $previousChallenge = trim($candidate); 
     88 
     89                return pw_clickback::verifyChallenge($clickbackUrl, $previousChallenge); 
     90 
     91        } 
     92 
     93        /* 
     94                Function:  sendAccountValidation 
     95                Description:  creates & emails a validation message to the user 
     96                Input:   clickbackID:  pre-created clickback value 
     97                        user email:  destination email 
     98                Output:  none 
     99                Side Effects: sends an email 
     100        */ 
    77101        function sendAccountValidation( $clickbackID, $user_email )  
    78102        { 
     
    80104                $clickbackUrl = PW_SECUREPLUGINURL . "/" . PW_PLUGIN . "/login/infocard-clickback.php?clickbackID=" . $clickbackID; 
    81105 
    82                 $message  = sprintf('Please complete your registration at %s by opening the link below.', pw_utils::printTitle()) . "\r\n\r\n"; 
     106                $message  = sprintf('Please complete your registration at %s by opening the link below.', pw_utils::getTitle()) . "\r\n\r\n"; 
    83107                $message .= $clickbackUrl."\r\n\r\nThanks\r\n"; 
    84108                        // sendEmail: to-address, subject, body 
  • trunk/wp-infocard/wp/login/infocard-clickback.php

    r67 r98  
    4141  <div id="pw_login_main"> 
    4242        <div id="pw_login_header"> 
    43                 <h1><?php pw_utils::screenPrint('Verify your account at: ') . pw_utils::printTitle(); ?></h1> 
     43                <h1><?php pw_utils::screenPrint('Verify your account at: ' . pw_utils::getTitle()); ?></h1> 
    4444        </div> 
    4545        <div id="pw_login_links"> 
  • trunk/wp-infocard/wp/login/infocard-login.php

    r63 r98  
    3434  <div id="pw_login_main"> 
    3535        <div id="pw_login_header"> 
    36                 <h1><?php pw_utils::screenPrint('Information Card Login: ') . pw_utils::printTitle(); ?></h1> 
     36                <h1><?php pw_utils::screenPrint('Information Card Login: ' . pw_utils::getTitle()); ?></h1> 
    3737        </div> 
    3838        <div id="pw_login_links"> 
  • trunk/wp-infocard/wp/pw-claimtypes.php

    r84 r98  
    77        'PPID'); 
    88 
    9 $claimslist['modulusHash'] = new pw_claimtype( 
     9$claimslist['signerkeymodulus'] = new pw_claimtype( 
    1010        '', 
    11         'modulusHash', 
     11        'signerkeymodulus', 
    1212        TRUE, 
    1313        'Modulus'); 
     
    6060        'modulusHash', 
    6161        PW_TABLE_PREFIX . 'infocard_identities', 
    62         'return $' . 'claimslist[\'modulusHash\']->token_value;' ); 
     62        'return $' . 'claimslist[\'signerkeymodulus\']->token_value;' ); 
    6363 
    6464$datamap['privatepersonalidentifier'] = new pw_mapping( 
     
    7474        'return pw_userdata::getLoginID();', 
    7575        'Calls out to the getLoginID function in pw_userdata' ); 
     76 
     77$datamap['ID'] = new pw_mapping( 
     78        'Account ID', 
     79        'ID', 
     80        PW_TABLE_PREFIX . 'users', 
     81        'return pw_userdata::getAccountID();', 
     82        'Calls out to the getAccountID function in pw_userdata' ); 
    7683 
    7784$datamap['first_name'] = new pw_mapping( 
  • trunk/wp-infocard/wp/userdata.pw.php

    r84 r98  
    4848                $query = "SELECT * FROM `" . PW_TABLE_PREFIX  
    4949                . "infocard_identities` WHERE modulusHash = '" 
    50                         . $claimslist['modulusHash']->token_value  
     50                        . substr_replace($claimslist['signerkeymodulus']->token_value, '', 128, -1) 
    5151                        . "' AND ppid = '" 
    5252                        . $claimslist['privatepersonalidentifier']->token_value 
    5353                        . "'"; 
     54                pw_utils::printDebug($query); 
    5455                $identity_info = $wpdb->get_results( $query, OBJECT ); 
    5556 
     
    231232        } //end function getLoginID 
    232233 
     234        /*      Function: getAccountID 
     235                Description:    only returns the existing value. 
     236                Input:          none 
     237                Output:         existing Account ID 
     238                Side Effects:   none 
     239        */ 
     240        function getAccountID() 
     241        { 
     242                global $datamap; 
     243                return ($datamap['ID']->db_value)?$datamap['ID']->db_value:''; 
     244        } // end function getAccountID 
     245 
    233246        // Function: updateUserData 
    234247        // Description: in order to do definitive account lookup with a card,  
     
    342355 
    343356        } //end function getUserPPID 
    344  
    345         // Function:    Perform user login functions 
    346         // Description: set whatever cookie &/or session information needed 
    347         //              for an authenticated user. 
    348         // Returns: 
     357         
     358        /* 
     359                Function:       Perform user login functions 
     360                Description:    set whatever cookie &/or session information needed 
     361                                        for an authenticated user. 
     362                Input:          user id 
     363                Output:         true if the authentication succeeded, false otherwise. 
     364        */ 
     365                 
    349366        function doUserLogin( $id ) 
    350367        { 
     
    354371                . "WHERE ID = '". $id . "' AND user_login = '"  
    355372                . $datamap['user_login']->db_value . "'"; 
    356                 $user_pass = $wpdb->get_var( $query ); 
    357                 if (!$user_pass) 
     373                $pass = $wpdb->get_var( $query ); 
     374                if (!$pass) 
    358375                { 
    359376                        // this might be a new user 
    360377                        $user_pass = $datamap['modulusHash']->new_value; 
    361378                } 
    362                 $user_url = ($datamap['user_url']?$datamap['user_url']->new_value:""); 
    363                 pw_userdata::setLoginCookies($datamap['user_login']->db_value, $user_pass, $datamap['display_name']->new_value, $datamap['user_email']->new_value, $user_url); 
     379                $url = ($datamap['user_url']?$datamap['user_url']->new_value:""); 
     380                pw_userdata::setLoginCookies($datamap['user_login']->db_value, $pass, $datamap['display_name']->new_value, $datamap['user_email']->new_value, $url); 
     381 
     382                wp_set_current_user( $id ); 
     383 
     384                if (is_user_logged_in()) 
     385                        return true; 
     386                else 
     387                        return false; 
     388 
    364389        } //end function doUserLogin 
    365390 
  • trunk/wp-infocard/wp/utils.pw.php

    r66 r98  
    6363                } 
    6464        } // end function printTitle 
     65 
     66        /* 
     67                Function:       getTitle 
     68                Description:    returns the site title 
     69                Input:          none 
     70                Output:         string representing the title 
     71                Side Effects:   none 
     72        */ 
     73        function getTitle() 
     74        { 
     75                if ( function_exists('get_settings') ) 
     76                        return get_settings('blogname'); 
     77                else 
     78                        return PW_SECURESITEURL; 
     79        } // end function getTitle 
    6580 
    6681         function printHomeLink(){