dev-master
9999999-dev
MIT
The Requires
- php >=5.4.0
- illuminate/support 4.1.x
by Daniel Albornoz
laravel auth
Wallogit.com
2017 © Pedro Peláez
Add functionality to the Auth component on Laravel4 to only login users with an active account., (*1)
In the require key of composer.json file add, (*2)
"daninoz/active-auth": "dev-master"
Run the Composer update comand, (*3)
$ composer update
In your config/app.php add 'Daninoz\ActiveAuth\ActiveAuthServiceProvider' to the end of the $providers array, (*4)
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...
'Daninoz\ActiveAuth\ActiveAuthServiceProvider',
),
Set the propertly values to the config/auth.php., (*5)
In your user table you just need and active field. By default, Active Auth will look for a field called active but you can change that., (*6)
Run:, (*7)
$ php artisan config:publish daninoz/active-auth
And a config file is going to be created on app/config/packages/daninoz/active-auth/config.php. Just change the active-field key., (*8)
$credentials = [
'email' => Input::get('email'),
'password' => Input::get('password')
];
$response = ActiveAuth::activeAttempt($credentials);
switch ($response) {
case ActiveAuth::INVALID_CREDENTIALS:
case ActiveAuth::INACTIVE_USER:
return Redirect::back()->with('error', Lang::get($response));
case ActiveAuth::SUCCESS:
return Redirect::intended('/');
}
Active Auth is free software distributed under the terms of the MIT license, (*9)
MIT
laravel auth