-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Events.php
30 lines (25 loc) · 891 Bytes
/
Events.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace gm\humhub\modules\auth\mastodon;
use humhub\components\Event;
use humhub\modules\user\authclient\Collection;
use gm\humhub\modules\auth\mastodon\authclient\Mastodon;
use gm\humhub\modules\auth\mastodon\models\ConfigureForm;
class Events
{
/**
* @param Event $event
*/
public static function onAuthClientCollectionInit($event)
{
/** @var Collection $authClientCollection */
$authClientCollection = $event->sender;
if (!empty(ConfigureForm::getInstance()->enabled)) {
$authClientCollection->setClient('mastodon', [
'class' => Mastodon::class,
'clientId' => ConfigureForm::getInstance()->clientId,
'clientSecret' => ConfigureForm::getInstance()->clientSecret,
'apiBaseUrl' => ConfigureForm::getInstance()->serverUrl,
]);
}
}
}