I've managed to change the password field in the code through overriding various classes/methods. But I after trying to override EloquentUserProvider and it's validateCredentials() method I keep getting an error -
ErrorException in AuthUserProvider.php line 15:
Argument 1 passed to App\Providers\AuthUserProvider::__construct() must be an instance of App\Helpers\Sha1Hasher, instance of Illuminate\Foundation\Application given
I created an override App\Providers\AuthUserProvider.php -
namespace App\Providers;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
use App\Helpers\Sha1Hasher as HasherContract;
use Illuminate\Auth\EloquentUserProvider;
class AuthUserProvider extends EloquentUserProvider
{
/**
* AuthUserProvider constructor.
* @param HasherContract $hasher
* @param string $model
*/
public function __construct(HasherContract $hasher, $model)
{
parent::__construct($hasher, $model);
}
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserContract $user, array $credentials)
{
// $plain = $credentials['sha_pass_hash'];
// return HasherContract::check(...);;
}
}
using Laravel 5.2.22.
if(Auth::attempt(['new_password_column' => $password, 'new_username_column'=>$username])) { //login success }