コード例 #1
0
 /**
  * Processes a user password update
  * @param array $passedToView
  */
 public static function updatePassword($passedToView = array())
 {
     $post = Core\Input::post();
     $passedToView["post"] = $post;
     $user = User::constructById($_SESSION["user"]);
     //check if password is set
     if (isset($post["password"])) {
         //check if password is valid
         if ($user->getPassword() === crypt($post["password"], $user->getPassword())) {
             //if new password matches
             if (isset($post["newPassword"]) && $post["newPassword"] === $post["confirmPassword"]) {
                 $password = crypt($post["newPassword"]);
                 $user->setPassword($password);
                 Model\User::updateUser($user);
             } else {
                 //new password does not match
             }
         } else {
             //password does not match
         }
     }
     ob_start();
     $url = 'http://sfsuswe.com/~nthanlee/index.php/PetBasket/contactUpdate';
     while (ob_get_status()) {
         ob_end_clean();
     }
     header("Location: {$url}");
 }
コード例 #2
0
ファイル: user.php プロジェクト: allanjg89/Pet-Basket-Website
 /**
  * Update this User in the database
  * @return type mixed   false on failure, integer of newly created row otherwise
  */
 public function update()
 {
     return Model\User::updateUser($this);
 }