If you're not using a password, really all you need to do is:
$authorised = User::where('email', $email)->exists();
But, if you want to create your own passwordless UserProvider, you could extend EloquentUserProvider and override the validateCredentials to not check the password, as so:
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
use Illuminate\Auth\EloquentUserProvider;
class NoPasswordUserProvider extends EloquentUserProvider {
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)
{
return true;
}
}
You'll probably need to create new service provider for it, too:
class NoPasswordUserServiceProvider extends ServiceProvider {
public function boot()
{
Auth::extend('NoPasswordAuth', function($app)
{
$model = $this->app['config']['auth.model'];
return new NoPasswordUserProvider($this->app['hash'], $model);
});
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// TODO: Implement register() method.
}
}
Obviously, the code isn't fully tested but that should more or less work.