Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Auth package not working in oil task
  • Hi there,

    I'm trying to create a simple task to reset a password using Auth::reset_password() that I am running through oil. The task runs, and a new password is returned and the database is updated, but I am unable to log in with the new password.

    When I run the same code from within the before method in the admin module, the code works correctly and I am able to log in with the new password (the Auth package is added to the always_load config in the admin module).

    I have tried loading the auth package in the oil file with Package::load('auth'); and I have tried manually loading the config's for auth and simpleauth from within the oil file, but I am still unable to log in with the password returned.

    Is there something else I am missing to manually load the auth package from within oil?

    Many thanks

  • The method works you say, so there is nothing wrong with loading the package. If the package wasn't loaded, you would have gotten a "class not found" error.

    Anything in your "admin"module that may influence the outcome, like an "auth.php" config file that is present in the module but Oil has no knowledge of? It's the only external dependency to generating a new password hash.
  • Hi Harro,

    Thanks for your response. There is an auth.php config file in the admin module which contains:

    return array(
        'driver' => 'Simpleauth',
        'verify_multiple_logins' => false,
        'salt' => 'SALTWASHERE',
        'iterations' => 10000,

    I have tried manually loading the auth config from the oil file with Config::load('admin::auth'), both before and after loading the package, but I'm still unable to log in.

    There is also a simpleauth.php config which I have also tried loading in the same way.
  • The only two "external dependencies" in generating the password hash are the salt and the number of iterations, so they must be different for some reason.

    You can check that by dumping Config::get('auth') in both your oil task and a controller, and check the differences.

    I think you indeed need to manually load the module config in your oil task, which you do like this:

    \Config::load('admin::auth', 'auth');

Howdy, Stranger!

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

In this Discussion