Exemplo n.º 1
0
 public function action_login()
 {
     // already logged in?
     if (Auth::check()) {
         // yes, so go back to the page the user came from, or the
         // application dashboard if no previous page can be detected
         //Messages::info(__('login.already-logged-in'));
         Response::redirect_back('');
     }
     // was the login form posted?
     if (Input::method() == 'POST') {
         // check the credentials.
         print_r(Input::all());
         if (Auth::login(Input::param('email'), Input::param('password'))) {
             // did the user want to be remembered?
             if (Input::param('remember', false)) {
                 // create the remember-me cookie
                 Auth::remember_me();
             } else {
                 // delete the remember-me cookie if present
                 Auth::dont_remember_me();
             }
             // logged in, go back to the page the user came from, or the
             // application dashboard if no previous page can be detected
             Response::redirect_back('/home');
         } else {
             // login failed, show an error message
             $this->error = 'test';
         }
     }
     // display the login page
     return \View::forge('auth/login');
 }
Exemplo n.º 2
0
 public function post_login()
 {
     $data = (object) Input::post();
     if (Auth::login($data->username, $data->password)) {
         return \Response::redirect('admin/home');
     }
     return \Response::redirect('admin/login');
 }
Exemplo n.º 3
0
 /**
  * ユーザ登録
  * @return \Fuel\Core\View
  */
 public function post_create()
 {
     if ($_POST) {
         //POSTデータを受け取る
         $username = Input::post('username');
         $password = Input::post('password');
         $email = Input::post('mail');
         $gender = Input::post('gender');
         $age = Input::post('age');
         $profile['gender'] = $gender;
         $profile['age'] = $age;
         //ユーザー登録
         $id = Auth::create_user($username, $password, $email);
         if (!empty($id)) {
             $result = Model_Users::find_by_pk($id)->set(array('age' => $age, 'gender' => $gender))->save();
             Auth::login($username, $password);
         }
     }
     Response::redirect('top');
 }