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,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([

View File

@ -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 = ''; //

View File

@ -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);