From a073e73f6dbf79cf5acc23acebecf0e14bc37e65 Mon Sep 17 00:00:00 2001 From: v Date: Fri, 29 Aug 2025 23:51:20 +0800 Subject: [PATCH] =?UTF-8?q?up.=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/admin/auth/AuthController.php | 35 ++++++++------------ z_ele/src/layout/components/lock-dialog.vue | 4 +-- z_ele/src/plugins/websocket/core/event.ts | 9 +++-- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/app/controller/admin/auth/AuthController.php b/app/controller/admin/auth/AuthController.php index e7a0372..75b6aef 100644 --- a/app/controller/admin/auth/AuthController.php +++ b/app/controller/admin/auth/AuthController.php @@ -54,28 +54,19 @@ class AuthController extends BaseController 'user_id' => $this->auth->userId, ])->find(); if($clientModel && $clientModel['is_lock']) { - if (empty($clientModel['lock_password'])) { - if(!password_verify($password, $this->auth->getUser()->get('password'))) { - SysUserClientLog::create([ - 'event' => 'UNLOCK_ERROR', - 'message'=> "1. 尝试解锁,密码错误", - 'data' => json_encode(['inputPass'=> password_hash($password, PASSWORD_DEFAULT)]), - 'create_time' => date('Y-m-d H:i:s'), - 'client_data_id'=> $clientModel['id'] - ]); - return $this->writeError('密码错误'); - } - }else{ - if($clientModel['lock_password'] !== $password){ - SysUserClientLog::create([ - 'event' => 'UNLOCK_ERROR', - 'message'=> "2. 尝试解锁,密码错误", - 'data' => json_encode(['inputPass'=> $password]), - 'create_time' => date('Y-m-d H:i:s'), - 'client_data_id'=> $clientModel['id'] - ]); - return $this->writeError('密码错误'); - } + if( + !password_verify($password, $this->auth->getUser()->get('password')) + && + !password_verify($password, $clientModel['lock_password']) + ) { + SysUserClientLog::create([ + 'event' => 'UNLOCK_ERROR', + 'message'=> "1. 尝试解锁,密码错误", + 'data' => json_encode(['inputPass'=> password_hash($password, PASSWORD_DEFAULT)]), + 'create_time' => date('Y-m-d H:i:s'), + 'client_data_id'=> $clientModel['id'] + ]); + return $this->writeError('密码错误'); } $clientModel->save(['is_lock'=>0,'lock_password'=>'','lock_time'=>null]); SysUserClientLog::create([ diff --git a/z_ele/src/layout/components/lock-dialog.vue b/z_ele/src/layout/components/lock-dialog.vue index a8ac239..fd0274e 100644 --- a/z_ele/src/layout/components/lock-dialog.vue +++ b/z_ele/src/layout/components/lock-dialog.vue @@ -55,12 +55,12 @@ /* * 先快速锁定当前窗口的 */ - useClientStore().setLockScreen(LockScreenStatus.LOCK); + // useClientStore().setLockScreen(LockScreenStatus.LOCK); /* * 通知设备下的窗口全部锁屏 */ wsInstance.sendSystemMessage(WsSystemEvent.LOCK_CLIENT, { - lockPassword: lockPassword.value + password: lockPassword.value }); visible.value = false; lockPassword.value = ''; // 清空密码 diff --git a/z_ele/src/plugins/websocket/core/event.ts b/z_ele/src/plugins/websocket/core/event.ts index f7a5946..4a7b2cc 100644 --- a/z_ele/src/plugins/websocket/core/event.ts +++ b/z_ele/src/plugins/websocket/core/event.ts @@ -1,5 +1,6 @@ import { ElNotification } from 'element-plus'; import Swal from 'sweetalert2'; +import { LockScreenStatus, useClientStore } from '@/store/modules/client'; class ScriptEvent { ElNotification(options = {}) { ElNotification(options); @@ -19,8 +20,12 @@ class SystemEvent { /** * 登录成功事件 */ - loginSuccess(){ - + loginSuccess() {} + /** + * 锁定客户端 + */ + lockClient() { + useClientStore().setLockScreen(LockScreenStatus.LOCK); } trigger(name, data) { console.debug('ws.trigger#system', name, data);