Example #1
0
 function auth($data = null)
 {
     $this->session = new Session();
     $auth = new User();
     $test_user = $auth->find_one_by_email($data['email']);
     if (md5($data['password']) == $test_user->password) {
         $this->session->set('id', $test_user->id);
         $this->session->set('email', $test_user->email);
         $this->session->set('name', $test_user->name);
         $this->session->set('location', $test_user->location);
         redirect('users/prefs');
     } else {
         $this->title = "Authentication failed";
         $this->message = "The email or password was wrong!";
         pass_var('message', $this->message);
         pass_var('title', $this->title);
         redirect("users/login");
     }
 }