Skip to content

Commit

Permalink
Reordering parameters to make it easier to remember the order.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 6, 2011
1 parent e32f419 commit fbd798d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cake/libs/controller/components/auth/digest_authenticate.php
Expand Up @@ -231,10 +231,12 @@ public function generateResponseHash($digest, $password) {
/**
* 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);
}

Expand Down
Expand Up @@ -47,7 +47,7 @@ function setUp() {
'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';
Expand Down Expand Up @@ -296,7 +296,7 @@ function testParseAuthEmailAddress() {
* @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);
}
Expand Down

0 comments on commit fbd798d

Please sign in to comment.