Skip to content

Commit f4f1b1e

Browse files
authored
Merge pull request #180 from humhub/enh/endpoint-get-user-by-source
Improved `user/get-by-authclient` endpoint to support additional authentication clients
2 parents 3aa4498 + a791754 commit f4f1b1e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

controllers/user/UserController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ public function actionGetByEmail($email)
9393
*/
9494
public function actionGetByAuthclient($name, $id)
9595
{
96-
$user = User::findOne(['auth_mode' => $name, 'authclient_id' => $id]);
96+
$user = User::find()
97+
->alias('u')
98+
->joinWith('auths a', false)
99+
->where(['u.auth_mode' => $name, 'u.authclient_id' => $id])
100+
->orWhere(['a.source' => $name, 'a.source_id' => $id])
101+
->one();
97102

98103
if ($user === null) {
99104
return $this->returnError(404, 'User not found!');

docs/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
Changelog
22
=========
33

4-
0.10.4 (Unreleased)
5-
---------------------------
4+
0.10.4 (September 9, 2024)
5+
--------------------------
6+
- Enh #180: Improved `user/get-by-authclient` endpoint to support additional authentication clients.
67
- Enh #181: Added user profile `image_url` and `banner_url`
78
- Enh #179: Added new `resend` and `cancel` endpoints for user invite
89

0 commit comments

Comments
 (0)