fix(WebSocket): 修正成员ID验证并临时放宽认证参数检查
修正WebSocket连接中成员ID验证使用错误变量的问题,将$member_id改为$user_id 同时临时放宽认证参数检查,仅验证site_id,为后续配置调整做准备
This commit is contained in:
@@ -195,7 +195,7 @@ class WebSocket extends WebSocketBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// member_id 必须一致,避免冒用
|
// member_id 必须一致,避免冒用
|
||||||
if ((int)$data['member_id'] !== $member_id) {
|
if ((int)$data['member_id'] !== $user_id) {
|
||||||
throw new \Exception('TOKEN_ERROR');
|
throw new \Exception('TOKEN_ERROR');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,10 @@ abstract class WebSocketBase implements MessageComponentInterface
|
|||||||
$user_id = $data['user_id'] ?? null;
|
$user_id = $data['user_id'] ?? null;
|
||||||
$token = $data['token'] ?? null;
|
$token = $data['token'] ?? null;
|
||||||
|
|
||||||
if (empty($site_id) || empty($user_id) || empty($token)) {
|
// 暂时开放使用,后期根据配置或者实际需要,需要对其他参数进行验证
|
||||||
|
if (empty($site_id)
|
||||||
|
// || empty($user_id) || empty($token)
|
||||||
|
) {
|
||||||
throw new \Exception('Missing authentication parameters');
|
throw new \Exception('Missing authentication parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user