We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e4380bb + 7ae44e1 commit 4f77599Copy full SHA for 4f77599
1 file changed
src/Service/Action/Auth/LoginAction.php
@@ -19,6 +19,8 @@
19
use CakeDC\Api\Service\Action\Action;
20
use CakeDC\Users\Controller\Traits\LoginTrait;
21
use CakeDC\Users\Exception\UserNotFoundException;
22
+use Authentication\IdentityInterface;
23
+use Cake\Datasource\EntityInterface;
24
25
/**
26
* Class LoginAction
@@ -82,6 +84,14 @@ public function execute()
82
84
{
83
85
$socialLogin = false;
86
$user = $this->Auth->getIdentity();
87
+
88
+ if ($user instanceof IdentityInterface) {
89
+ $user = $user->getOriginalData()->toArray();
90
+ }
91
+ if ($user instanceof EntityInterface) {
92
+ $user = $user->toArray();
93
94
95
$user = $this->_afterIdentifyUser($user, $socialLogin);
96
if (empty($user)) {
97
throw new UserNotFoundException(__d('CakeDC/Api', 'User not found'), 401);
0 commit comments