mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Reordering parameters to make it easier to remember the order.
This commit is contained in:
parent
e32f419d0a
commit
fbd798da6c
2 changed files with 5 additions and 3 deletions
|
@ -231,10 +231,12 @@ class DigestAuthenticate extends BaseAuthenticate {
|
|||
/**
|
||||
* Creates an auth digest password hash to store
|
||||
*
|
||||
* @param string $username The username to use in the digest hash.
|
||||
* @param string $password The unhashed password to make a digest hash for.
|
||||
* @param string $realm The realm the password is for.
|
||||
* @return string the hashed password that can later be used with Digest authentication.
|
||||
*/
|
||||
public static function password($username, $realm, $password) {
|
||||
public static function password($username, $password, $realm) {
|
||||
return md5($username . ':' . $realm . ':' . $password);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class DigestAuthenticateTest extends CakeTestCase {
|
|||
'opaque' => '123abc'
|
||||
));
|
||||
|
||||
$password = DigestAuthenticate::password('mariano', 'localhost', 'cake');
|
||||
$password = DigestAuthenticate::password('mariano', 'cake', 'localhost');
|
||||
ClassRegistry::init('User')->updateAll(array('password' => '"' . $password . '"'));
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
|
@ -296,7 +296,7 @@ DIGEST;
|
|||
* @return void
|
||||
*/
|
||||
function testPassword() {
|
||||
$result = DigestAuthenticate::password('mark', 'localhost', 'password');
|
||||
$result = DigestAuthenticate::password('mark', 'password', 'localhost');
|
||||
$expected = md5('mark:localhost:password');
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue