Skip to content

Commit

Permalink
Release 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed Nov 23, 2023
1 parent d19dad8 commit 0a91ec6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
21 changes: 16 additions & 5 deletions authclient/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function authAction($authAction)
if (!Yii::$app->user->isGuest) {
Yii::$app->user->logout();
}

if ($token == '') {
return $this->redirectToBroker();
}
Expand All @@ -89,7 +89,7 @@ public function authAction($authAction)
return Yii::$app->getResponse()->redirect(['/user/auth/login']);
}

$this->setUserAttributes((array) $decodedJWT);
$this->setUserAttributes((array)$decodedJWT);
$this->autoStoreAuthClient();


Expand Down Expand Up @@ -157,13 +157,24 @@ protected function defaultTitle()
*/
protected function autoStoreAuthClient()
{
$attributes = $this->getUserAttributes();
$user = User::findOne(['email' => $attributes['email']]);
if ($user !== null) {
if ($this->getUserByAttributes() !== null) {
(new AuthClientUserService($user))->add($this);
}
}

/**
* @return User|null
*/
protected function getUserByAttributes()
{
$attributes = $this->getUserAttributes();
if (isset($attributes['email'])) {
return User::findOne(['email' => $attributes['email']]);
}

return null;
}

public function checkIPAccess()
{
if (empty($this->allowedIPs)) {
Expand Down
3 changes: 1 addition & 2 deletions authclient/JWTPrimary.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class JWTPrimary extends JWT implements PrimaryClient, AutoSyncUsers, SyncAttrib

public function getUser()
{
// Not supported
return null;
return $this->getUserByAttributes();
}

/**
Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.1.2 (November 23, 2023)
-------------------------

- Enh: Fixed Login Issue with `JWTPrimary` AuthClient

1.1.1 (June 14, 2023)
--------------------

Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sso",
"login"
],
"version": "1.1.1",
"version": "1.1.2",
"humhub": {
"minVersion": "1.14"
},
Expand Down

0 comments on commit 0a91ec6

Please sign in to comment.