Reordering parameters to make it easier to remember the order.

This commit is contained in:
mark_story 2011-02-06 16:59:47 -05:00
parent e32f419d0a
commit fbd798da6c
2 changed files with 5 additions and 3 deletions

View file

@ -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);
}

View file

@ -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);
}