Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Auth::login() function vs Auth::force_login()
  • Is there a way to know why the auth::login() function is failing to logging the user? Basically, I want to know how to debug it granted that that username and password in $_POST are correct.
    For some reason, I'm only able to use the Auth::force_login() function... 

    here is the code:
    // this works
    if (Input::method() == 'POST' && Input::post('submit')) {
                $form->validation()->run();
                if (!$form->validation()->error()) {
                    $login = Model_User::is_login_ok( Input::post('username'), Input::post('password') );
                    if ( gettype($login) == 'object' && get_class($login) == 'Model_User' ) {
                        Auth::force_login($login->id);
    }}}

    // this doesn't work
    if (Input::method() == 'POST' && Input::post('submit')) {
                $form->validation()->run();
                if (!$form->validation()->error()) {
                    $login = Model_User::login_ok( Input::post('username'), Input::post('password') );
                    $auth = Auth::instance();
                    if ( gettype($login) == 'object' && get_class($login) == 'Model_User' ) {
                        $auth->login(Input::post('username'), Input::post('password'));
                    }
                }
            }
  • Harro VertonHarro Verton
    Accepted Answer
    How did you create the user you're using to try to login? If you didn't use Auth::create_user(), perhaps you used the wrong hashing algorithm?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion