mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
oauth login check user is normal
This commit is contained in:
@@ -100,7 +100,11 @@ class OauthController extends Controller
|
|||||||
->first();
|
->first();
|
||||||
if ($socialAccount) {
|
if ($socialAccount) {
|
||||||
//already bind, login directly
|
//already bind, login directly
|
||||||
|
/**
|
||||||
|
* @var User $authUser
|
||||||
|
*/
|
||||||
$authUser = $socialAccount->user;
|
$authUser = $socialAccount->user;
|
||||||
|
$authUser->checkIsNormal();
|
||||||
logincookie($authUser->id, $authUser->auth_key);
|
logincookie($authUser->id, $authUser->auth_key);
|
||||||
return redirect($homeUrl);
|
return redirect($homeUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Enums\ModelEventEnum;
|
||||||
use App\Exceptions\InsufficientPermissionException;
|
use App\Exceptions\InsufficientPermissionException;
|
||||||
use App\Exceptions\NexusException;
|
use App\Exceptions\NexusException;
|
||||||
use App\Http\Resources\ExamUserResource;
|
use App\Http\Resources\ExamUserResource;
|
||||||
@@ -697,7 +698,7 @@ class UserRepository extends BaseRepository
|
|||||||
NexusDB::statement(sprintf('DELETE FROM snatched WHERE userid IN (%s) and not exists (select 1 from torrents where id = snatched.torrentid)', $uidStr));
|
NexusDB::statement(sprintf('DELETE FROM snatched WHERE userid IN (%s) and not exists (select 1 from torrents where id = snatched.torrentid)', $uidStr));
|
||||||
if (is_int($id)) {
|
if (is_int($id)) {
|
||||||
do_action("user_delete", $id);
|
do_action("user_delete", $id);
|
||||||
fire_event("user_destroyed", $users->first());
|
fire_event(ModelEventEnum::USER_DELETED, $users->first());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1422,12 +1422,7 @@ function get_user_from_cookie(array $cookie, $isArray = true): array|\App\Models
|
|||||||
do_log("$log, user not exists");
|
do_log("$log, user not exists");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
$row->checkIsNormal();
|
||||||
$row->checkIsNormal();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
do_log("$log, " . $e->getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$authKey = $row->auth_key;
|
$authKey = $row->auth_key;
|
||||||
}
|
}
|
||||||
$expectedSignature = hash_hmac('sha256', $tokenJson, $authKey);
|
$expectedSignature = hash_hmac('sha256', $tokenJson, $authKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user