[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/data/validator/passwordvalidator.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" ); 8 lt_include( PLOG_CLASS_PATH."class/summary/data/summarytools.class.php" ); 9 10 class SummaryUpdatePassword extends SummaryAction 11 { 12 var $_userNameHash; 13 var $_requestHash; 14 var $_newPassword; 15 var $_retypeNewPassword; 16 var $_userId; 17 18 function SummaryUpdatePassword( $actionInfo, $request ) 19 { 20 $this->SummaryAction( $actionInfo, $request ); 21 22 $this->registerFieldValidator( "a", new StringValidator()); 23 $this->registerFieldValidator( "b", new StringValidator()); 24 $this->registerFieldValidator( "newPassword", new PasswordValidator()); 25 $this->registerFieldValidator( "retypePassword", new PasswordValidator()); 26 $this->registerFieldValidator( "userId", new IntegerValidator()); 27 $view = new SummaryView( "changepassword" ); 28 $view->setErrorMessage( $this->_locale->tr("error_updating_password")); 29 $this->setValidationErrorView( $view ); 30 } 31 32 function perform() 33 { 34 $this->_userNameHash = $this->_request->getValue( "b" ); 35 $this->_requestHash = $this->_request->getValue( "a" ); 36 $this->_newPassword = $this->_request->getValue( "newPassword" ); 37 $this->_retypeNewPassword = $this->_request->getValue( "retypePassword" ); 38 $this->_userId = $this->_request->getValue( "userId" ); 39 40 // check if the passwords are correct and are the same 41 if( $this->_newPassword != $this->_retypeNewPassword ) { 42 $this->_view = new SummaryView( "changepassword" ); 43 $this->_view->setErrorMessage( $this->_locale->tr("error_passwords_do_not_match" )); 44 $this->setCommonData( true ); 45 return false; 46 } 47 48 $userInfo = SummaryTools::verifyRequest( $this->_userNameHash, $this->_requestHash ); 49 if( !$userInfo ) { 50 $this->_view = new SummaryView( "summaryerror" ); 51 $this->_view->setErrorMessage( $this->_locale->tr("error_incorrect_request" )); 52 $this->setCommonData( true ); 53 return false; 54 } 55 56 // so if everything went fine, we can *FINALLY* change the password! 57 $users = new Users(); 58 $userInfo->setPassword( $this->_newPassword ); 59 $users->updateUser( $userInfo ); 60 $this->_view = new SummaryView( "message" ); 61 $this->_view->setSuccessMessage( $this->_locale->tr("password_updated_ok" )); 62 63 return true; 64 } 65 } 66 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |