Skip to content
Browse files

Tweak user interface.

  • Loading branch information...
1 parent a3f7350 commit 0798395423fa9a4ff7efc7962a102bf7ca52a2b9 @taylorotwell taylorotwell committed Aug 30, 2012
View
2 src/Illuminate/Auth/DatabaseUserProvider.php
@@ -97,7 +97,7 @@ public function validateCredentials(UserInterface $user, array $credentials)
{
$plain = $credentials['password'];
- return $this->hasher->check($plain, $user->getPassword());
+ return $this->hasher->check($plain, $user->getAuthPassword());
}
}
View
2 src/Illuminate/Auth/EloquentUserProvider.php
@@ -74,7 +74,7 @@ public function validateCredentials(UserInterface $user, array $credentials)
{
$plain = $credentials['password'];
- return $this->hasher->check($plain, $user->getPassword());
+ return $this->hasher->check($plain, $user->getAuthPassword());
}
/**
View
4 src/Illuminate/Auth/GenericUser.php
@@ -25,7 +25,7 @@ public function __construct(array $attributes)
*
* @return mixed
*/
- public function getIdentifier()
+ public function getAuthIdentifier()
{
return $this->attributes['id'];
}
@@ -35,7 +35,7 @@ public function getIdentifier()
*
* @return string
*/
- public function getPassword()
+ public function getAuthPassword()
{
return $this->attributes['password'];
}
View
2 src/Illuminate/Auth/Guard.php
@@ -173,7 +173,7 @@ public function attempt(array $credentials = array(), $remember = false)
*/
public function login(UserInterface $user, $remember = false)
{
- $id = $user->getIdentifier();
+ $id = $user->getAuthIdentifier();
$this->session->put($this->getName(), $id);
View
4 src/Illuminate/Auth/UserInterface.php
@@ -7,13 +7,13 @@
*
* @return mixed
*/
- public function getIdentifier();
+ public function getAuthIdentifier();
/**
* Get the password for the user.
*
* @return string
*/
- public function getPassword();
+ public function getAuthPassword();
}
View
6 tests/DatabaseUserProviderTest.php
@@ -20,7 +20,7 @@ public function testRetrieveByIDReturnsUserWhenUserIsFound()
$user = $provider->retrieveByID(1);
$this->assertInstanceOf('Illuminate\Auth\GenericUser', $user);
- $this->assertEquals(1, $user->getIdentifier());
+ $this->assertEquals(1, $user->getAuthIdentifier());
$this->assertEquals('Dayle', $user->name);
}
@@ -49,7 +49,7 @@ public function testRetrieveByCredentialsReturnsUserWhenUserIsFound()
$user = $provider->retrieveByCredentials(array('username' => 'dayle', 'password' => 'foo'));
$this->assertInstanceOf('Illuminate\Auth\GenericUser', $user);
- $this->assertEquals(1, $user->getIdentifier());
+ $this->assertEquals(1, $user->getAuthIdentifier());
$this->assertEquals('taylor', $user->name);
}
@@ -75,7 +75,7 @@ public function testCredentialValidation()
$hasher->shouldReceive('check')->once()->with('plain', 'hash')->andReturn(true);
$provider = new Illuminate\Auth\DatabaseUserProvider($conn, $hasher, 'foo');
$user = m::mock('Illuminate\Auth\UserInterface');
- $user->shouldReceive('getPassword')->once()->andReturn('hash');
+ $user->shouldReceive('getAuthPassword')->once()->andReturn('hash');
$result = $provider->validateCredentials($user, array('password' => 'plain'));
$this->assertTrue($result);
View
2 tests/EloquentUserProviderTest.php
@@ -44,7 +44,7 @@ public function testCredentialValidation()
$hasher->shouldReceive('check')->once()->with('plain', 'hash')->andReturn(true);
$provider = new Illuminate\Auth\EloquentUserProvider($hasher, 'foo');
$user = m::mock('Illuminate\Auth\UserInterface');
- $user->shouldReceive('getPassword')->once()->andReturn('hash');
+ $user->shouldReceive('getAuthPassword')->once()->andReturn('hash');
$result = $provider->validateCredentials($user, array('password' => 'plain'));
$this->assertTrue($result);
View
4 tests/GuardTest.php
@@ -44,7 +44,7 @@ public function testLoginStoresIdentifierInSession()
$mock = $this->getMock('Illuminate\Auth\Guard', array('getName'), array($provider, $session, $request));
$user = m::mock('Illuminate\Auth\UserInterface');
$mock->expects($this->once())->method('getName')->will($this->returnValue('foo'));
- $user->shouldReceive('getIdentifier')->once()->andReturn('bar');
+ $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar');
$mock->getSession()->shouldReceive('put')->with('foo', 'bar')->once();
$mock->login($user);
}
@@ -121,7 +121,7 @@ public function testLoginMethodQueuesCookieWhenRemembering()
$guard->setEncrypter($encrypter);
$guard->getSession()->shouldReceive('put')->once();
$user = m::mock('Illuminate\Auth\UserInterface');
- $user->shouldReceive('getIdentifier')->once()->andReturn('foo bar');
+ $user->shouldReceive('getAuthIdentifier')->once()->andReturn('foo bar');
$guard->login($user, true);
$cookies = $guard->getQueuedCookies();

0 comments on commit 0798395

Please sign in to comment.
Something went wrong with that request. Please try again.