2017 © Pedro Peláez
 

library active-auth

image

daninoz/active-auth

  • Thursday, February 6, 2014
  • by daninoz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 137 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Active Auth

Add functionality to the Auth component on Laravel4 to only login users with an active account., (*1)

Setup

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',

),

Configuration

Set the propertly values to the config/auth.php., (*5)

Users table

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)

Example

$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('/');
}

License

Active Auth is free software distributed under the terms of the MIT license, (*9)

Bitdeli Badge, (*10)

The Versions

06/02 2014

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Daniel Albornoz

laravel auth