OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
37
app/Domain/Oidc/Controllers/Callback.php
Normal file
37
app/Domain/Oidc/Controllers/Callback.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Oidc\Controllers;
|
||||
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Leantime\Core\Controller\Controller;
|
||||
use Leantime\Core\Controller\Frontcontroller;
|
||||
use Leantime\Domain\Oidc\Services\Oidc as OidcService;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Callback extends Controller
|
||||
{
|
||||
private OidcService $oidc;
|
||||
|
||||
public function init(OidcService $oidc): void
|
||||
{
|
||||
$this->oidc = $oidc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException|HttpResponseException
|
||||
*/
|
||||
public function get($params): Response
|
||||
{
|
||||
$code = $_GET['code'];
|
||||
$state = $_GET['state'];
|
||||
|
||||
try {
|
||||
return $this->oidc->callback($code, $state);
|
||||
} catch (\Exception $e) {
|
||||
$this->tpl->setNotification($e->getMessage(), 'danger', 'oidc_error');
|
||||
|
||||
return Frontcontroller::redirect(BASE_URL.'/auth/login');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user