Exemplo n.º 1
0
 public function actionChangepassword()
 {
     $userId = Yii::app()->user->id;
     $userId = 1;
     $userProfile = UserApi::getUserById($userId);
     $userImageId = array($userId);
     $image = ImagesApi::getPrimaryImageForUsers($userImageId);
     if ($image) {
         $userImage = $image[$userId];
     } else {
         $userImage = ImageUtils::getDefaultImage("user");
     }
     $userAge = UserApi::getAge($userProfile->dob);
     $userAddress = UserApi::getLocation($userProfile->city_id);
     if (isset($_POST['confirm'])) {
         if ($_POST['oldpass'] == $userProfile->password) {
             $userProfile = $_POST['UserProfiles'];
             $changePassword = UserApi::updateUserById($userId, $userProfile);
         } else {
             echo "incorrect password";
         }
         //var_dump($changePassword);
         //$userProfile->password
         $this->redirect("http://localhost/powengine/account/settings");
     }
     if (isset($_POST['cancel'])) {
         $this->redirect("http://localhost/powengine/account/settings");
     }
     $this->render('changepassword', array('userProfile' => $userProfile, 'userImage' => $userImage, 'userAge' => $userAge, 'userAddress' => $userAddress));
 }