up. 优化代码内容

This commit is contained in:
扶桑花间 2025-08-29 23:51:20 +08:00
parent 1702dd02a4
commit a073e73f6d
3 changed files with 22 additions and 26 deletions

View File

@ -54,8 +54,11 @@ class AuthController extends BaseController
'user_id' => $this->auth->userId, 'user_id' => $this->auth->userId,
])->find(); ])->find();
if($clientModel && $clientModel['is_lock']) { if($clientModel && $clientModel['is_lock']) {
if (empty($clientModel['lock_password'])) { if(
if(!password_verify($password, $this->auth->getUser()->get('password'))) { !password_verify($password, $this->auth->getUser()->get('password'))
&&
!password_verify($password, $clientModel['lock_password'])
) {
SysUserClientLog::create([ SysUserClientLog::create([
'event' => 'UNLOCK_ERROR', 'event' => 'UNLOCK_ERROR',
'message'=> "1. 尝试解锁,密码错误", 'message'=> "1. 尝试解锁,密码错误",
@ -65,18 +68,6 @@ class AuthController extends BaseController
]); ]);
return $this->writeError('密码错误'); 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('密码错误');
}
}
$clientModel->save(['is_lock'=>0,'lock_password'=>'','lock_time'=>null]); $clientModel->save(['is_lock'=>0,'lock_password'=>'','lock_time'=>null]);
SysUserClientLog::create([ SysUserClientLog::create([
'event' => 'UNLOCK_SUCCESS', 'event' => 'UNLOCK_SUCCESS',

View File

@ -55,12 +55,12 @@
/* /*
* 先快速锁定当前窗口的 * 先快速锁定当前窗口的
*/ */
useClientStore().setLockScreen(LockScreenStatus.LOCK); // useClientStore().setLockScreen(LockScreenStatus.LOCK);
/* /*
* 通知设备下的窗口全部锁屏 * 通知设备下的窗口全部锁屏
*/ */
wsInstance.sendSystemMessage(WsSystemEvent.LOCK_CLIENT, { wsInstance.sendSystemMessage(WsSystemEvent.LOCK_CLIENT, {
lockPassword: lockPassword.value password: lockPassword.value
}); });
visible.value = false; visible.value = false;
lockPassword.value = ''; // lockPassword.value = ''; //

View File

@ -1,5 +1,6 @@
import { ElNotification } from 'element-plus'; import { ElNotification } from 'element-plus';
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
import { LockScreenStatus, useClientStore } from '@/store/modules/client';
class ScriptEvent { class ScriptEvent {
ElNotification(options = {}) { ElNotification(options = {}) {
ElNotification(options); ElNotification(options);
@ -19,8 +20,12 @@ class SystemEvent {
/** /**
* *
*/ */
loginSuccess(){ loginSuccess() {}
/**
*
*/
lockClient() {
useClientStore().setLockScreen(LockScreenStatus.LOCK);
} }
trigger(name, data) { trigger(name, data) {
console.debug('ws.trigger#system', name, data); console.debug('ws.trigger#system', name, data);