Skip to content

Commit afe2349

Browse files
authored
Merge pull request #22 from pmoraes/issue/21
refs #21 making the finder as custom
2 parents e6caaf0 + d4e7309 commit afe2349

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"require": {
3030
"php": ">=5.4.16",
3131
"cakephp/cakephp": "3.*",
32-
"cakedc/users": "^4.0"
32+
"cakedc/users": "^5.0"
3333
},
3434
"require-dev": {
3535
"cakedc/users": "*" ,

src/Service/Action/Auth/LoginAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function execute()
7979
$user = $this->_afterIdentifyUser($user, $socialLogin);
8080
}
8181
if (empty($user)) {
82-
throw new UserNotFoundException(__d('CakeDC/Api', 'User not found'));
82+
throw new UserNotFoundException(__d('CakeDC/Api', 'User not found'), 401);
8383
} else {
8484
return $user;
8585
}

src/Service/Auth/Authenticate/TokenAuthenticate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getUser(Request $request)
8181

8282
$this->_config['fields']['username'] = $this->config('field');
8383
$this->_config['userModel'] = $this->config('table');
84-
$this->_config['finder'] = 'all';
84+
$this->_config['finder'] = $this->getConfig('finderAuth') ?: 'all';
8585
$result = $this->_query($apiKey)->first();
8686

8787
if (empty($result)) {

tests/TestCase/Integration/Service/Action/Auth/LoginActionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testLoginFail()
7676
{
7777
$this->sendRequest('/auth/login', 'POST', ['username' => 'user-1', 'password' => '111']);
7878
$result = $this->responseJson();
79-
$this->assertError($result, 404);
79+
$this->assertError($result, 401);
8080
$this->assertErrorMessage($result, 'User not found');
8181
}
8282
}

tests/TestCase/Integration/Service/Action/Auth/ValidateAccountActionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testSuccessValidateAccount()
5656
{
5757
$this->sendRequest('/auth/login', 'POST', ['username' => 'user-6', 'password' => '12345']);
5858
$result = $this->responseJson();
59-
$this->assertError($result, 404);
59+
$this->assertError($result, 401);
6060
$this->assertErrorMessage($result, 'User not found');
6161

6262
$this->sendRequest('/auth/validate_account', 'POST', ['token' => 'token-6']);

0 commit comments

Comments
 (0)