Example #1
0
 public function __construct()
 {
     $employee = new Employee();
     if (!$employee->isLoggedIn()) {
         Redirect::to('employee/login');
     }
 }
Example #2
0
 public function changePasswordAction()
 {
     $employee = new Employee();
     if (!$employee->isLoggedIn()) {
         Redirect::to('home');
     }
     if (Input::exists()) {
         if (!Token::check(Input::get('token'))) {
             Redirect::to();
         }
         $data = ['password_current' => Input::get('password_current'), 'password_new' => Input::get('password_new'), 'password_new_again' => Input::get('password_new_again')];
         $success = $this->model()->changePassword($data);
         if ($success) {
             Redirect::to('home');
         } else {
             $context['errors'] = $this->model()->getErrors();
         }
     }
     $context['token'] = Token::generate();
     echo $this->view('employee/changepassword', $context);
 }