Changeset 43
- Timestamp:
- 05/22/07 15:28:34 (2 years ago)
- Files:
-
- trunk/wp-infocard/wp/login/class.infocard-login.php (modified) (1 diff)
- trunk/wp-infocard/wp/login/infocard-login.php (modified) (1 diff)
- trunk/wp-infocard/wp/userdata.pw.php (modified) (8 diffs)
- trunk/wp-infocard/wp/utils.pw.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-infocard/wp/login/class.infocard-login.php
r42 r43 131 131 //print get_settings('siteurl') . "/wp-login.php"; 132 132 // hardcoded for now FIX THIS before release 133 print get_settings('s ecuresiteurl')133 print get_settings('siteurl') 134 134 . "/wp-login.php"; 135 135 } trunk/wp-infocard/wp/login/infocard-login.php
r40 r43 75 75 <tr><td colspan="2"> 76 76 <ul><li> 77 <a href="<?php bloginfo(' wpurl'); ?>/wp-register.php"><?php _e('Register', 'wp-infocard'); ?></a>77 <a href="<?php bloginfo('siteurl'); ?>/wp-register.php"><?php _e('Register', 'wp-infocard'); ?></a> 78 78 </li><li> 79 <a href="<?php bloginfo(' wpurl'); ?>/wp-login.php?action=lostpassword" title="Password Lost and Found"><?php _e('Lost your password?', 'wp-infocard'); ?></a>79 <a href="<?php bloginfo('siteurl'); ?>/wp-login.php?action=lostpassword" title="Password Lost and Found"><?php _e('Lost your password?', 'wp-infocard'); ?></a> 80 80 </li></ul> 81 81 </td></tr> trunk/wp-infocard/wp/userdata.pw.php
r42 r43 3 3 include_once( dirname(__FILE__) . '/../pw-config.php'); 4 4 include_once( dirname(__FILE__) . '/utils.pw.php'); 5 //require_once( ABSPATH . WPINC . '/registration-functions.php');5 include_once( ABSPATH . WPINC . '/registration-functions.php'); 6 6 7 7 /* … … 32 32 // Side-effects: none 33 33 34 function evaluateIncomingRequest( $email='', $modulusHash='', $ppid='')35 { 36 global $wpdb ;34 function evaluateIncomingRequest() 35 { 36 global $wpdb, $claimslist, $datamap; 37 37 $incominguser['id'] = 0; 38 38 $incominguser['status'] = 'UNKNOWNERROR'; 39 39 $identity_user_id = 0; 40 40 41 InfocardUtils::printDebug( '<br/>Evaluating Incoming Request:<br/>');42 43 if (!is_email($ email)) {41 pw_utils::printDebug( '<br/>Evaluating Incoming Request:<br/>'); 42 43 if (!is_email($claimslist['emailaddress']->token_value)) { 44 44 $incominguser['status'] = "INVALIDEMAIL"; 45 45 return $incominguser; 46 46 } 47 47 48 $query = "SELECT * FROM `wp_infocard_identities` WHERE modulusHash = " 49 . "'$modulusHash' AND ppid = '$ppid'"; 48 $query = "SELECT * FROM `" . PW_TABLE_PREFIX 49 . "infocard_identities` WHERE modulusHash = '" 50 . $claimslist['modulusHash']->token_value 51 . "' AND ppid = '" 52 . $claimslist['privatepersonalidentifier']->token_value 53 . "'"; 50 54 $identity_info = $wpdb->get_results( $query, OBJECT ); 51 55 … … 55 59 // could be valid-user, or new-email 56 60 $identity_user_id = $identity_info[0]->accountid; 61 $datamap['modulusHash']->add_db_value($identity_info[0]->modulusHash); 62 $datamap['privatepersonalidentifier']->add_db_value($identity_info[0]->ppid); 63 57 64 break; 58 65 … … 69 76 70 77 71 pw_utils::printDebug(' Identity_user_id: ' . $identity_user_id . "<br/>" ); 72 73 74 $query = "SELECT * from wp_users WHERE user_email LIKE '$email'"; 78 pw_utils::printDebug(' Card belongs to account #: ' . $identity_user_id . "<br/>" ); 79 80 81 $query = "SELECT * from " . PW_TABLE_PREFIX . "users " 82 . "WHERE user_email LIKE '" 83 . $claimslist['emailaddress']->token_value . "'"; 84 75 85 $user_info = $wpdb->get_results( $query, ARRAY_A ); 76 86 … … 79 89 case 1: 80 90 $mail_user_id = $user_info[0][ID]; 81 $incominguser['user_row'] = $user_info[0]; 82 83 if ($identity_user_id == $mail_user_id) 84 { 85 $incominguser['id'] = $mail_user_id; 86 $incominguser['status'] = 'valid-user'; 87 } 88 elseif ($identity_user_id == 0) 89 { 90 $incominguser['id'] = $mail_user_id; 91 $incominguser['status'] = 'new-card'; 92 93 } 94 else 95 { 96 $incominguser['status'] = "CLAIMSMISMATCHED"; 97 return $incominguser; 98 } 91 pw_utils::printDebug(' User belongs to account #: ' . $mail_user_id . "<br/>" ); 92 if ($identity_user_id == 0) 93 { 94 $incominguser['id'] = $mail_user_id; 95 $incominguser['status'] = 'new-card'; 96 } 97 elseif ($identity_user_id != $mail_user_id) 98 { 99 $incominguser['status'] = "CLAIMSMISMATCHED"; 100 return $incominguser; 101 } 102 if ($identity_user_id == $mail_user_id) 103 { 104 $incominguser['id'] = $mail_user_id; 105 $incominguser['status'] = 'valid-user'; 106 107 } 108 foreach (array_keys($datamap) as $key) 109 { 110 if (array_key_exists($datamap[$key]->mappingattribute, $user_info[0])) 111 { 112 pw_utils::printDebug('Mapping: found '.$datamap[$key]->mappingattribute.' in user_info[0]<br/>'); 113 $datamap[$key]->add_db_value($user_info[0][$datamap[$key]->mappingattribute]); 114 } 115 } 116 117 // special case for first, last name 118 $first = get_usermeta($mail_user_id, 'first_name'); 119 pw_utils::printDebug('FIRST: ' . $first . '<br/>'); 120 $datamap['first_name']->add_db_value(get_usermeta($mail_user_id, 'first_name')); 121 $datamap['last_name']->add_db_value(get_usermeta($mail_user_id, 'last_name')); 99 122 break; 100 123 … … 120 143 } 121 144 122 pw_utils::printDebug( " Email_user_id: $mail_user_id <br/>" );123 InfocardUtils::printDebug( " Status: " . $incominguser['status'] . "<br/>" );145 pw_utils::printDebug( " Email address belongs toaccount #: $mail_user_id <br/>" ); 146 pw_utils::printDebug( " Status: " . $incominguser['status'] . "<br/><br/>" ); 124 147 125 148 return $incominguser; 126 149 } // end function evaluateIncomingRequest 127 150 128 129 151 function mapTokenData() 130 152 { 131 153 global $claimslist, $datamap; 132 pw_utils::printDebug('<br/>Mapped Data:<br/>');154 pw_utils::printDebug('<br/>Mapped Token Data:<br/>'); 133 155 foreach(array_keys($datamap) as $key) 134 156 { … … 138 160 } 139 161 } // end function mapTokenData 162 163 // Function: getLoginID 164 // Description: always returns existing value if it exists 165 // otherwise for now takes the email address. 166 function getLoginID() 167 { 168 global $datamap; 169 $loginid = $datamap['user_login']->db_value; 170 if ($loginid) 171 { 172 pw_utils::printDebug(' getLoginID: Login ID already exists: '.$loginid.'<br/>'); 173 return $loginid; 174 } 175 $loginid = $datamap['user_email']->new_value; 176 //$loginid = 'pamtest'; 177 pw_utils::printDebug(' getLoginID: Login ID generated: '.$loginid.'<br/>'); 178 return $loginid; 179 } //end function getLoginID 180 181 // Function: updateUserData 182 // Description: in order to do definitive account lookup with a card, 183 // the PPID/modulus combination must uniquely identify an 184 // account. This may change in the future. 185 // Input: ppid, certificate modulus, account ID 186 // Output: none 187 // Side effect: modifies table data 188 function updateUserData( $ID, $datamap ) 189 { 190 global $wpdb; 191 192 // not sure if there is a more graceful way to do this... 193 $user_login = $datamap['user_login']->db_value; 194 if (!$datamap['display_name']->compare()) 195 { 196 $display_name = $datamap['display_name']->new_value; 197 $user_nicename = $display_name; 198 } 199 if (!$datamap['user_email']->compare()) 200 $user_email = $datamap['user_email']->new_value; 201 202 if (($datamap['user_url']) && (!$datamap['user_url']->compare())) 203 $user_url = $datamap['user_url']->new_value; 204 205 if (!$datamap['first_name']->compare()) 206 $first_name = $datamap['first_name']->new_value; 207 208 if (!$datamap['last_name']->compare()) 209 $last_name = $datamap['last_name']->new_value; 210 211 $userdata = compact('ID', 'user_login', 'user_email', 'user_nicename', 'user_url', 'display_name', 'first_name', 'last_name'); 212 213 if (wp_update_user($userdata)) 214 { 215 pw_utils::printDebug(' User Updates Successful'); 216 pw_utils::printDebug($query); 217 } 218 } // end function updateUserData 140 219 141 220 // Function: updateIdentityData … … 198 277 } // end function updateIdentityData 199 278 200 // Function: getLoginID 201 // Description: always returns existing value if it exists 202 // otherwise for now takes the email address. 203 function getLoginID() 279 // Function: Perform user login functions 280 // Description: set whatever cookie &/or session information needed 281 // for an authenticated user. 282 // Returns: 283 function doUserLogin($id, $username, $ppid ) 204 284 { 205 285 global $datamap; 206 $loginid = $datamap['loginid']->db_value; 207 208 if ($loginid) 209 return $loginid; 210 211 $loginid = $datamap['email']->new_value; 212 return $loginid; 213 } 286 // note - don't put any debug statements in here, we are buffering in the main infocard-post file 287 $user_url = ($datamap['user_url']?$datamap['user_url']->new_value:""); 288 InfocardProcessing::setLoginCookies($username, $ppid, $datamap['display_name']->new_value, $datamap['user_email']->new_value, $user_url); 289 //mosRedirect('index.php'); 290 } //end function doUserLogin 214 291 215 292 } // end class pw_userdata trunk/wp-infocard/wp/utils.pw.php
r41 r43 176 176 foreach ($datamap as $map) 177 177 { 178 pw_utils::printDebug($map-> handle . " in "178 pw_utils::printDebug($map->displayname . " in " 179 179 . $map->mappingtable . "." 180 180 . $map->mappingattribute
