Example #1
0
 public function changepwd()
 {
     $this->_loggedIn();
     if (isset($_POST['changesubmitted'])) {
         $result = $this->user->changepwd($_SESSION['username'], $_POST['oldpwd'], $_POST['newpwd']);
         $val = $result ? 'Password changed successfully' : 'Password could not be changed';
         Session::setFlashMessage($val);
         if ($result) {
             Helper::redirect('user/logout');
         } else {
             $userlist = $this->user->browse();
             $data = array('title' => 'list of users', 'list' => $userlist);
             Load::view('user_list.php', $data);
             //make a notice page for Password Changed
         }
     } else {
         $data = array('title' => 'Change password', 'data' => NULL);
         Load::view('change_password.php', $data);
     }
 }