Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upadate the key of table name of password #549

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Confide _(A Laravel4 Package)_
# Confide _(A Laravel5 Package)_

![Confide Poster](https://dl.dropbox.com/u/12506137/libs_bundles/confide.png)

Expand All @@ -16,8 +16,6 @@ Confide is an authentication solution for **Laravel** made to cut repetitive wor

Confide aims to be simple to use, quick to configure and flexible.

> Note: If you are using MongoDB check [Confide Mongo](https://github.com/Zizaco/confide-mongo).

## Features

**Current:**
Expand All @@ -35,8 +33,6 @@ Confide aims to be simple to use, quick to configure and flexible.

If you are looking for user roles and permissions see [Entrust](https://github.com/Zizaco/entrust)

For MongoDB support see [Confide Mongo](https://github.com/Zizaco/confide-mongo)

**Warning:** _By default a confirmation email is sent and users are required to confirm the email address.
It is easy to change this in the confide config file.
Change `signup_email` and `signup_confirm` to false if you do not want to send them an email and they do not need
Expand All @@ -49,7 +45,7 @@ to be confirmed to be able to login to the website._
In the `require` key of `composer.json` file add the following

```json
"zizaco/confide": "~4.3@dev"
"zizaco/confide": "5.0.x-dev"
```

Run the Composer update comand
Expand Down Expand Up @@ -271,7 +267,7 @@ Confide::makeResetPasswordForm($token):
You would use:

```php
View::make(Config::get('confide::reset_password_form'))
View::make(Config::get('confide.reset_password_form'))
->with('token', $token);
```

Expand Down Expand Up @@ -371,6 +367,12 @@ For example: `"zizaco/confide": "~3.2"` will avoid composer download version 4.0

## Release Notes

### Version 5.0.0 Beta 1
* Laravel 5 Support

### Version 4.3.0
* General Bugfixes.

### Version 4.3.0 Beta 1
* **Username is now an optional field.** Use `--username` when generating the migrations and the controllers.
* General Bugfixes.
Expand Down Expand Up @@ -462,6 +464,4 @@ Confide is free software distributed under the terms of the MIT license

## Aditional information

Any questions, feel free to contact me or ask [here](http://forums.laravel.io/viewtopic.php?id=4658)

Any issues, please [report here](https://github.com/Zizaco/confide/issues)
Any questions or issues, please [post here](https://github.com/Zizaco/confide/issues)
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "~4.2|~5.0"
"illuminate/support": "~5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.9",
"illuminate/auth": "~4.2",
"illuminate/console": "~4.2",
"illuminate/database": "~4.2",
"illuminate/console": "~5.0",
"illuminate/database": "~5.0",
"satooshi/php-coveralls": "~0.6"
},
"suggest": {
Expand All @@ -33,6 +32,9 @@
"src/migrations",
"src/commands"
],
"files": [
"src/Confide/helpers.php"
],
"psr-4": {
"Zizaco\\Confide\\": "src/Confide/"
}
Expand Down
18 changes: 10 additions & 8 deletions src/Confide/CacheLoginThrottleService.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php namespace Zizaco\Confide;

use Illuminate\Contracts\Foundation\Application;

/**
* The LoginThrottle is a service that Throttles login after
* too many failed attempts. This is a secure measure in
Expand All @@ -13,18 +15,18 @@ class CacheLoginThrottleService implements LoginThrottleServiceInterface
/**
* Laravel application.
*
* @var \Illuminate\Foundation\Application
* @var \Illuminate\Contracts\Foundation\Application
*/
public $app;

/**
* Create a new PasswordService.
*
* @param \Illuminate\Foundation\Application $app Laravel application object.
* @param \Illuminate\Contracts\Foundation\Application $app Laravel application object.
*/
public function __construct($app = null)
public function __construct(Application $app)
{
$this->app = $app ?: app();
$this->app = $app;
}

/**
Expand Down Expand Up @@ -57,7 +59,7 @@ public function isThrottled($identity)
// Retuns the current count
$count = $this->countThrottle($identity, 0);

return $count >= $this->app['config']->get('confide::throttle_limit');
return $count >= $this->app->make('config')->get('confide.throttle_limit');
}

/**
Expand Down Expand Up @@ -97,14 +99,14 @@ protected function parseIdentity($identity)
*/
protected function countThrottle($identityString, $increments = 1)
{
$count = $this->app['cache']
$count = $this->app->make('cache')
->get('login_throttling:'.md5($identityString), 0);

$count = $count + $increments;

$ttl = $this->app['config']->get('confide::throttle_time_period');
$ttl = $this->app->make('config')->get('confide.throttle_time_period');

$this->app['cache']
$this->app->make('cache')
->put('login_throttling:'.md5($identityString), $count, $ttl);

return $count;
Expand Down
30 changes: 16 additions & 14 deletions src/Confide/Confide.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php namespace Zizaco\Confide;

use Illuminate\Contracts\Foundation\Application;

/**
* This class is the main entry point to use the confide
* services. Usually this is the only service class that the
Expand All @@ -13,7 +15,7 @@ class Confide
/**
* Laravel application.
*
* @var \Illuminate\Foundation\Application
* @var \Illuminate\Contracts\Foundation\Application
*/
public $app;

Expand Down Expand Up @@ -44,20 +46,20 @@ class Confide
* @param \Zizaco\Confide\RepositoryInterface $repo
* @param \Zizaco\Confide\PasswordServiceInterface $passService
* @param \Zizaco\Confide\LoginThrottleServiceInterface $loginThrottler
* @param \Illuminate\Foundation\Application $app Laravel application object
* @param \Illuminate\Contracts\Foundation\Application $app Laravel application object
*
* @return void
*/
public function __construct(
RepositoryInterface $repo,
PasswordServiceInterface $passService,
LoginThrottleServiceInterface $loginThrottler,
$app = null
Application $app
) {
$this->repo = $repo;
$this->passService = $passService;
$this->loginThrottler = $loginThrottler;
$this->app = $app ?: app();
$this->app = $app;
}

/**
Expand All @@ -77,7 +79,7 @@ public function model()
*/
public function user()
{
return $this->app['auth']->user();
return $this->app->make('auth')->user();
}

/**
Expand Down Expand Up @@ -135,7 +137,7 @@ public function logAttempt(array $input, $mustBeConfirmed = true)
return false;
}

$correctPassword = $this->app['hash']->check(
$correctPassword = $this->app->make('hash')->check(
isset($input['password']) ? $input['password'] : false,
$user->password
);
Expand All @@ -144,7 +146,7 @@ public function logAttempt(array $input, $mustBeConfirmed = true)
return false;
}

$this->app['auth']->login($user, $remember);
$this->app->make('auth')->login($user, $remember);
return true;
}

Expand Down Expand Up @@ -199,7 +201,7 @@ protected function loginThrottling($identity)
$count = $this->loginThrottler
->throttleIdentity($identity);

if ($count >= $this->app['config']->get('confide::throttle_limit')) {
if ($count >= $this->app->make('config')->get('confide.throttle_limit')) {
return false;
}

Expand Down Expand Up @@ -280,7 +282,7 @@ public function userByResetPasswordToken($token)
*/
public function logout()
{
return $this->app['auth']->logout();
return $this->app->make('auth')->logout();
}

/**
Expand All @@ -290,7 +292,7 @@ public function logout()
*/
public function makeLoginForm()
{
return $this->app['view']->make($this->app['config']->get('confide::login_form'));
return $this->app->make('view')->make($this->app->make('config')->get('confide.login_form'));
}

/**
Expand All @@ -300,7 +302,7 @@ public function makeLoginForm()
*/
public function makeSignupForm()
{
return $this->app['view']->make($this->app['config']->get('confide::signup_form'));
return $this->app->make('view')->make($this->app->make('config')->get('confide.signup_form'));
}

/**
Expand All @@ -310,7 +312,7 @@ public function makeSignupForm()
*/
public function makeForgotPasswordForm()
{
return $this->app['view']->make($this->app['config']->get('confide::forgot_password_form'));
return $this->app->make('view')->make($this->app->make('config')->get('confide.forgot_password_form'));
}

/**
Expand All @@ -320,8 +322,8 @@ public function makeForgotPasswordForm()
*/
public function makeResetPasswordForm($token)
{
return $this->app['view']->make(
$this->app['config']->get('confide::reset_password_form'),
return $this->app->make('view')->make(
$this->app->make('config')->get('confide.reset_password_form'),
array('token' => $token)
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Confide/ConfideUserInterface.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace Zizaco\Confide;

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Illuminate\Contracts\Auth\Authenticatable;

/**
* Interface that declares the methods that must be
Expand All @@ -14,7 +13,7 @@
* @license MIT
* @package Zizaco\Confide
*/
interface ConfideUserInterface extends UserInterface, RemindableInterface
interface ConfideUserInterface extends Authenticatable
{
/**
* Confirm the user (usually means that the user) email is valid.
Expand Down
Loading