2017 © Pedro Peláez
 

library auth2

Laravel 4 - Multi Auth With Password Reminder

image

dayed/auth2

Laravel 4 - Multi Auth With Password Reminder

  • Tuesday, July 1, 2014
  • by Matt Ma
  • Repository
  • 1 Watchers
  • 0 Stars
  • 148 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

Laravel 4 Multi Auth With Password Reminder

Installation

Open your composer.json file, and add the new required package., (*1)

"pingpong/auth2": "dev-master", (*2)

Next, open a terminal and run., (*3)

composer update, (*4)

After the composer updated. Add new service provider in app/config/app.php., (*5)

'Pingpong\Auth2\Auth2ServiceProvider' Open your terminal and run:, (*6)

php artisan config:publish pingpong/auth2, (*7)

Finish., (*8)

Configuration File

```php, (*9)

return array(

    // example 
    'admin' =>  array(
        'driver'    => 'eloquent',
        'model'     => 'Admin',
        'table'     => 'admins',
        'view'      => 'emails.auth.reminder'
    ),      

);

```, (*10)

Example

Auth

```php, (*11)

Auth2::admin()->attempt($credentials, $remember);, (*12)

if(Auth2::admin()->check()) { // code }, (*13)

Auth2::admin()->get(); //it's same with Auth::user() , for get credentials, (*14)

Auth2::admin()->logout();, (*15)

```, (*16)

Password Reminder

Password Remind, (*17)

```php, (*18)

/**
 * Handle a POST request to remind a user of their password.
 *
 * @return Response
 */
public function postRemind()
{
    $response = Password2::admin()->remind(Input::only('email'), function($message)
    {
        $message->subject('Password Reminder');
    });

    switch ($response)
    {
        case 'reminders.user':
            return Redirect::back()->with('error', Lang::get($response));

        case 'reminders.sent':
            return Redirect::back()->with('status', Lang::get($response));
    }
}

```, (*19)

Password Reset, (*20)

```php, (*21)

/**
 * Handle a POST request to reset a user's password.
 *
 * @return Response
 */
public function postReset()
{
        $credentials = Input::only(
        'email', 'password', 'password_confirmation', 'token'
    );

    $response = Password2::admin()->reset($credentials, function($user, $password)
    {
        $user->password = Hash::make($password);

        $user->save();
    });

    switch ($response)
    {
        case 'reminders.password':
        case 'reminders.token':
        case 'reminders.user':
            return Redirect::back()->with('error', Lang::get($response));

        case 'reminders.reset':
            return Redirect::to('admin');
    }
}

```, (*22)

The Versions

01/07 2014

dev-master

9999999-dev

Laravel 4 - Multi Auth With Password Reminder

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel auth pingpong auth2 multiauth

01/07 2014

dev-dev

dev-dev

Laravel 4 - Multi Auth With Password Reminder

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel auth pingpong auth2 multiauth

01/07 2014

v1

1.0.0.0

Laravel 4 - Multi Auth With Password Reminder

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel auth pingpong auth2 multiauth