Changeset 110
- Timestamp:
- 10/08/07 21:29:25 (1 year ago)
- Files:
-
- trunk/wp-infocard/site-messages/en-us/new-card.html (modified) (1 diff)
- trunk/wp-infocard/site-messages/en-us/new-email.html (modified) (1 diff)
- trunk/wp-infocard/site-messages/en-us/new-user.html (modified) (1 diff)
- trunk/wp-infocard/site-messages/en-us/trusted-new-user.html (added)
- trunk/wp-infocard/site-messages/en-us/verified-new-card.html (added)
- trunk/wp-infocard/site-messages/en-us/verified-new-user.html (added)
- trunk/wp-infocard/wp/admin.pw.php (modified) (2 diffs)
- trunk/wp-infocard/wp/audit.pw.php (modified) (1 diff)
- trunk/wp-infocard/wp/userdata.pw.php (modified) (14 diffs)
- trunk/wp-infocard/wp/utils.pw.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-infocard/site-messages/en-us/new-card.html
r1 r110 1 1 <h2>Changing Your Card</h2> 2 <p> Your account can only be associated with one information card. The information card you just used to log in is not the one we have on file. If you wish to keep the original card you registered at <?php bloginfo('home'); ?>, simply login again with the correct card. If you wish to replace your original card with this new card, please follow the instructions below.</p>2 <p>For now, your account can only be associated with one information card. The information card you just used to log in is not the one we have on file. If you wish to keep the original card you registered at <?php bloginfo('home'); ?>, simply login again with the correct card. If you wish to replace your original card with this new card, please follow the instructions below.</p> 3 3 4 4 <p><a href="<?php bloginfo('home'); ?>"><?php bloginfo('blogname'); ?></a> is sending you an email. It contains a link back to the site. Please click on that link, which will take you to a page where you will log in using your new Information Card. These steps validate you by proving that your claim to control an email address is legitimate.</p> trunk/wp-infocard/site-messages/en-us/new-email.html
r1 r110 1 1 <h2>Email Address Change</h2> 2 <p>The email address stored within your information card has changed. You must re-validate the new email address.</p> 3 <p><a href="<?php bloginfo('home'); ?>"><?php bloginfo('blogname'); ?></a> is sending you an email. It contains a link back to this site. Please click on that link, which will validate you by proving that your claim to control the new email address is legitimate.</p> 4 <p>If you altered the address by mistake, simply delete the email, edit your information card to again contain the original email address, and login again. </p> 5 <p>Thank you for your help.</p> 6 2 <p>Your email address has changed - please note that your login ID is based on your original email address, and will remain the same. This will be important if you ever need to recover your regular password.</p> trunk/wp-infocard/site-messages/en-us/new-user.html
r1 r110 1 <h2>Registration Validation </h2>1 <h2>Registration Validation Required</h2> 2 2 3 3 <p>Thank you for registering an Information Card. You must validate the email address in your card before you can continue.</p> 4 4 5 5 <p>This blog is currently sending you an email. It contains a link back to this site. Please click on that link, which will validate you by proving that your claim to control the registered email address is legitimate.</p> 6 <p>Once you have successfully clicked on the email link, you will be able to post without going through a moderation queue.</p>7 trunk/wp-infocard/wp/admin.pw.php
r108 r110 63 63 $myTableAuditQuery = 64 64 "CREATE TABLE `$this->table_audit` ( 65 `modulusHash` varchar(128) NOT NULL default '', 66 `ppid` varchar(128) NOT NULL default '', 65 `cardhash` text default '', 67 66 `accountid` bigint(20) unsigned, 68 67 `email` varchar(128) NOT NULL default '', … … 204 203 $this->createOption('pw_custom_data', 0); 205 204 $this->createOption('pw_time_validation', 1); 206 $this->createOption('pw_trust_managed_cards', 0);207 $this->createOption('pw_trust_personal_cards', 0);205 $this->createOption('pw_trust_managed_cards', 'validate'); 206 $this->createOption('pw_trust_personal_cards', 'validate'); 208 207 $this->createOption('pw_trusted_idp_list', ''); 209 208 trunk/wp-infocard/wp/audit.pw.php
r102 r110 14 14 // Output: none 15 15 // Side Effects: alters DB table 16 function writeToAudit($ip, $ modulus='NA', $ppid='NA', $email='NA', $error, $acct='NA')16 function writeToAudit($ip, $cardhash='NA', $email='NA', $error, $acct='NA') 17 17 { 18 18 global $wpdb; trunk/wp-infocard/wp/userdata.pw.php
r108 r110 169 169 $datamap[$key]->new_value = eval($datamap[$key]->mappingfunction); 170 170 //pw_utils::printDebug(' Mapping Function: '.$datamap[$key]->mappingfunction.'<br/>'); 171 pw_utils::printDebug(' Newly Mapped Value: '.$datamap[$key]->handle.' Value: '.$datamap[$key]->new_value.'<br/>');171 pw_utils::printDebug(' ' . $datamap[$key]->handle.' Value: '.$datamap[$key]->new_value.'<br/>'); 172 172 } 173 173 pw_utils::printDebug('<br />'); … … 182 182 { 183 183 include_once( ABSPATH . WPINC . '/registration-functions.php'); 184 184 185 $user_login = $datamap['user_login']->new_value; 186 pw_utils::printDebug('Creating account: ' . $user_login . '<br />'); 187 188 if (!pw_userdata::userLoginIsUnique($user_login)) 189 { 190 pw_utils::printDebug('ERROR: User Login ID is NOT unique<br />'); 191 return FALSE; 192 } 193 else 194 { 195 pw_utils::printDebug('User Login ID is unique<br />'); 196 } 197 185 198 if (!$datamap['display_name']->compare()) 186 199 { … … 190 203 if (!$datamap['user_email']->compare()) 191 204 $user_email = $datamap['user_email']->new_value; 205 206 if (!$datamap['cardhash']->compare()) 207 $user_pass = $datamap['cardhash']->new_value; 208 192 209 if (($datamap['user_url']) && (!$datamap['user_url']->compare())) 193 210 $user_url = $datamap['user_url']->new_value; … … 196 213 if (!$datamap['last_name']->compare()) 197 214 $last_name = $datamap['last_name']->new_value; 198 $userdata = compact('user_login', 'user_ email', 'user_nicename', 'user_url', 'display_name', 'first_name', 'last_name');215 $userdata = compact('user_login', 'user_pass', 'user_email', 'user_nicename', 'user_url', 'display_name', 'first_name', 'last_name'); 199 216 200 217 pw_utils::printDebug("<br/>Action: createNewAccount<br>"); … … 204 221 { 205 222 pw_utils::printDebug(" Inserted record # $user_ID<br>"); 223 $datamap['user_login']->add_db_value($datamap['user_login']->new_value); 206 224 return $user_ID; 207 225 } … … 251 269 function updateUserData( $ID, $datamap ) 252 270 { 253 pw_utils::printDebug('Comparing Existing Values to Newly Mapped Values:<br />'); 254 //global $wpdb; 271 pw_utils::printDebug('Comparing Existing Values to Newly Mapped Values for Account # ' . $ID . ':<br />'); 255 272 256 273 // not sure if there is a more graceful way to do this... … … 281 298 { 282 299 pw_utils::printDebug(' WP-User Updates Successful'); 283 pw_utils::printDebug($query);284 300 } 285 301 } // end function updateUserData … … 294 310 function updateIdentityData( $datamap ) 295 311 { 312 if (!$datamap['ID']->new_value) 313 { 314 pw_utils::printDebug('ERROR: no ID value in datamap for updateIdentityData<br />'); 315 return 'INTERNALERROR'; 316 } 317 296 318 global $wpdb; 297 319 $acct = $datamap['ID']->new_value; … … 341 363 else 342 364 { 343 pw_utils::printDebug( ' No Updates Needed<br/>' );365 pw_utils::printDebug( ' No Card updates needed<br/>' ); 344 366 } 345 367 break; … … 360 382 function doUserLogin( $id ) 361 383 { 384 if (!$id) 385 { 386 pw_utils::printDebug('ERROR: No ID passed to doUserLogin!'); 387 return FALSE; 388 } 389 362 390 global $datamap, $wpdb; 391 if (!$datamap['user_login']->db_value) 392 { 393 pw_utils::printDebug('ERROR: No user login in datamap to doUserLogin!'); 394 return FALSE; 395 } 396 363 397 // note - don't put any debug statements in here, we are buffering in the main infocard-post file 364 398 $query = "SELECT user_pass FROM " . PW_TABLE_PREFIX . "users " 365 . "WHERE ID = '". $id . "' AND user_login = '" 399 . "WHERE ID = '". $id 400 . "' AND user_login = '" 366 401 . $datamap['user_login']->db_value . "'"; 402 367 403 $pass = $wpdb->get_var( $query ); 368 404 if (!$pass) 369 405 { 370 406 // this might be a new user 371 $user_pass = $datamap[' modulusHash']->new_value;407 $user_pass = $datamap['cardhash']->new_value; 372 408 } 373 409 $url = ($datamap['user_url']?$datamap['user_url']->new_value:""); … … 422 458 case 0: 423 459 // Not found: return the defaults 424 pw_utils::printDebug(' Card not found .<br />' );460 pw_utils::printDebug(' Card not found via card hash.<br />' ); 425 461 break; 426 462 … … 441 477 442 478 $query = "SELECT * from " . PW_TABLE_PREFIX 443 . "users WHERE email LIKE '"479 . "users WHERE user_email LIKE '" 444 480 . $claimslist['emailaddress']->token_value . "'"; 445 481 446 $ identity_info = $wpdb->get_results( $query, ARRAY_A );482 $user_info = $wpdb->get_results( $query, ARRAY_A ); 447 483 448 484 switch (count($user_info)) … … 454 490 { 455 491 if (array_key_exists($datamap[$key]->mappingattribute, $user_info[0])) 492 { 456 493 $datamap[$key]->add_db_value($user_info[0][$datamap[$key]->mappingattribute]); 494 pw_utils::printDebug('Added: ' . $datamap[$key]->db_value . '<br />'); 495 } 457 496 } 458 497 … … 466 505 break; 467 506 default: 468 pw_utils::printDebug(' Multiple user accounts have the same ID.<br />' );507 pw_utils::printDebug(' getIdentityFromUserTable: Multiple user accounts have the same ID.<br />' ); 469 508 $card_info['error'] = "USERIDNOTUNIQUE"; 470 509 } 471 510 } //end function getIdentityFromUserTable 472 511 512 function updateCardInfoFromCardHash($cardhash) 513 { 514 $results['found'] = FALSE; 515 $results['error'] = ''; 516 if (!$cardhash) 517 { 518 pw_utils::printDebug('ERROR: updateCardInfoFromCardHash called without a Card Hash!<br/>'); 519 $results['error'] = 'INTERNALERROR'; 520 } 521 global $wpdb, $datamap; 522 523 pw_utils::printDebug( '<br/>Getting Card Info from Card Hash:' . $cardhash . '<br/>'); 524 525 $query = "SELECT * FROM `" . PW_TABLE_PREFIX 526 . "infocard_identities` WHERE cardhash = '" 527 . $cardhash . "'"; 528 $identity_info = $wpdb->get_results( $query, OBJECT ); 529 switch (count($identity_info)) 530 { 531 case 1: 532 // card is found 533 $datamap['ID']->add_db_value($identity_info[0]->accountid); 534 $datamap['cardhash']->add_db_value($identity_info[0]->cardhash); 535 $datamap['cardhandle']->add_db_value($identity_info[0]->cardhandle); 536 $results['found'] = TRUE; 537 pw_utils::printDebug(' Card belongs to account #: ' . $datamap['ID']->db_value . "<br/>" ); 538 break; 539 case 0: 540 // Not found: return the defaults 541 pw_utils::printDebug(' Card not found.<br />' ); 542 break; 543 544 default: 545 pw_utils::printDebug(' Multiple cards match the hash, return an error.<br />' ); 546 $results['error'] = "CARDNOTUNIQUE"; 547 } 548 549 return $results; 550 } 551 552 function updateUserInfoFromAccountID($accountID) 553 { 554 $results['found'] = FALSE; 555 $results['error'] = ''; 556 if (!$accountID) 557 { 558 pw_utils::printDebug('ERROR: updateUserInfoFromAccountID called without an AccountID!<br/>'); 559 $results['error'] = 'INTERNALERROR'; 560 } 561 global $wpdb, $datamap; 562 563 $query = "SELECT * from " . PW_TABLE_PREFIX 564 . "users WHERE ID = '" 565 . $accountID . "'"; 566 567 $user_info = $wpdb->get_results( $query, ARRAY_A ); 568 569 switch (count($user_info)) 570 { 571 case 1: 572 // 573 $results['found'] = TRUE; 574 pw_utils::printDebug(' User Data found & mapped, based on Account ID.<br />' ); 575 foreach (array_keys($datamap) as $key) 576 { 577 if (array_key_exists($datamap[$key]->mappingattribute, $user_info[0])) 578 { 579 // pw_utils::printDebug($key . ' updated to ' . $user_info[0][$key] . ': ' . $datamap[$key]->db_value . '<br />'); 580 $datamap[$key]->add_db_value($user_info[0][$datamap[$key]->mappingattribute]); 581 } 582 } 583 584 if ( PW_CUSTOM_DATA ) 585 pw_customdata::evaluateIncomingCustomData( $accountID ); 586 break; 587 588 case 0: 589 pw_utils::printDebug(' Card not found.<br />' ); 590 break; 591 default: 592 pw_utils::printDebug(' Multiple user accounts have the same ID.<br />' ); 593 $results['error'] = "USERIDNOTUNIQUE"; 594 } 595 return $results; 596 } 597 598 function updateCardInfoFromPPID($ppid, $modulus) 599 { 600 // not done yet; 601 $results['found'] = FALSE; 602 $results['error'] = ''; 603 return $results; 604 } 605 606 function updateUserInfoFromEmail($email) 607 { 608 $results['found'] = FALSE; 609 $results['error'] = ''; 610 if (!$email) 611 { 612 pw_utils::printDebug('ERROR: updateUserInfoFromEmail called without an Email!<br/>'); 613 $results['error'] = 'INTERNALERROR'; 614 } 615 global $wpdb, $datamap; 616 617 $query = "SELECT * from " . PW_TABLE_PREFIX 618 . "users WHERE user_email = '" 619 . $email . "'"; 620 621 $user_info = $wpdb->get_results( $query, ARRAY_A ); 622 623 switch (count($user_info)) 624 { 625 case 1: 626 // 627 $results['found'] = TRUE; 628 pw_utils::printDebug(' User Email address found & mapped.<br />' ); 629 foreach (array_keys($datamap) as $key) 630 { 631 if (array_key_exists($datamap[$key]->mappingattribute, $user_info[0])) 632 $datamap[$key]->add_db_value($user_info[0][$datamap[$key]->mappingattribute]); 633 } 634 635 if ( PW_CUSTOM_DATA ) 636 pw_customdata::evaluateIncomingCustomData( $accountID ); 637 break; 638 639 case 0: 640 pw_utils::printDebug(' Card not found via Email.<br />' ); 641 break; 642 default: 643 pw_utils::printDebug(' Multiple user accounts have the same Email.<br />' ); 644 $results['error'] = "USERIDNOTUNIQUE"; 645 } 646 return $results; 647 } 648 649 function updateCardInfoFromAccountID($accountID) 650 { 651 $results['found'] = FALSE; 652 $results['error'] = ''; 653 if (!$accountID) 654 { 655 pw_utils::printDebug('ERROR: updateCardInfoFromAccountID called without an Account ID!<br/>'); 656 $results['error'] = 'INTERNALERROR'; 657 } 658 global $wpdb, $datamap; 659 660 pw_utils::printDebug( '<br/>Getting Card Info from Account ID:' . $accountID . '<br/>'); 661 662 $query = "SELECT * FROM `" . PW_TABLE_PREFIX 663 . "infocard_identities` WHERE accountid = '" 664 . $accountID . "'"; 665 $identity_info = $wpdb->get_results( $query, OBJECT ); 666 switch (count($identity_info)) 667 { 668 case 1: 669 // card is found 670 $datamap['cardhash']->add_db_value($identity_info[0]->cardhash); 671 $datamap['cardhandle']->add_db_value($identity_info[0]->cardhandle); 672 $results['found'] = TRUE; 673 pw_utils::printDebug(' Card belongs to account #: ' . $accountID . "<br/>" ); 674 break; 675 case 0: 676 // Not found: return the defaults 677 break; 678 679 default: 680 pw_utils::printDebug(' Multiple cards match the hash, return an error.<br />' ); 681 $card_info['error'] = "CARDNOTUNIQUE"; 682 } 683 684 return $results; 685 }//end function updateCardInfoFromAccountID 686 687 function checkEmailAddress($claimslist, $datamap) 688 { 689 return $datamap['user_email']->db_value === $claimslist['emailaddress']->token_value; 690 }//end function checkEmailAddress 691 692 function userLoginIsUnique($user_login, $ID='impossible') 693 { 694 global $wpdb; 695 $query = 'SELECT user_login FROM ' . PW_TABLE_PREFIX 696 . 'users WHERE user_login = "' . $user_login . '"'; 697 698 $identity_info = $wpdb->get_results( $query, OBJECT ); 699 700 switch( count($identity_info) ) 701 { 702 case 0: 703 return TRUE; 704 break; 705 case 1: 706 pw_utils::printDebug('userLoginUnique - loginID found for Account # ' . $identity_info[0]->ID . '<br />'); 707 if ($identity_info[0]->ID == $ID) 708 return TRUE; 709 else 710 return FALSE; 711 712 default: 713 return FALSE; 714 } 715 }//end function userLoginIsUnique($user_login) 716 473 717 } // end class pw_userdata 474 718 ?> trunk/wp-infocard/wp/utils.pw.php
r108 r110 168 168 } // end function printUserMessageText 169 169 170 function getMessageLinks( $home='', $profile='', $login='', $pp='') 171 { 172 $output = "<ul>"; 173 if ($home) 174 { 175 print "<li><a href='"; 176 print bloginfo('home'); 177 print "'>"; 178 _e('Go to Blog'); 179 print "»</a></li>"; 180 } 181 182 if ($profile) 183 { 184 print " <li><a href='"; 185 print bloginfo('home'); 186 print "/wp-admin/profile.php'>"; 187 _e('View Profile'); 188 print "»</a></li></ul>"; 189 } 190 191 if ($login) 192 { 193 print "<a href='"; 194 print bloginfo('home'); 195 print "/wp-login.php'>"; 196 _e('Login Again'); 197 print "»</a></li></ul>"; 198 } 199 200 if ($pp) 201 { 202 } 203 $output .= "</ul>"; 204 return $output; 205 206 } 170 207 function printUserMessageLinks( $mesg_type ) 171 208 {
