up. 优化代码内容
This commit is contained in:
parent
1702dd02a4
commit
a073e73f6d
@ -54,28 +54,19 @@ 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'))
|
||||||
SysUserClientLog::create([
|
&&
|
||||||
'event' => 'UNLOCK_ERROR',
|
!password_verify($password, $clientModel['lock_password'])
|
||||||
'message'=> "1. 尝试解锁,密码错误",
|
) {
|
||||||
'data' => json_encode(['inputPass'=> password_hash($password, PASSWORD_DEFAULT)]),
|
SysUserClientLog::create([
|
||||||
'create_time' => date('Y-m-d H:i:s'),
|
'event' => 'UNLOCK_ERROR',
|
||||||
'client_data_id'=> $clientModel['id']
|
'message'=> "1. 尝试解锁,密码错误",
|
||||||
]);
|
'data' => json_encode(['inputPass'=> password_hash($password, PASSWORD_DEFAULT)]),
|
||||||
return $this->writeError('密码错误');
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
}
|
'client_data_id'=> $clientModel['id']
|
||||||
}else{
|
]);
|
||||||
if($clientModel['lock_password'] !== $password){
|
return $this->writeError('密码错误');
|
||||||
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([
|
||||||
|
|||||||
@ -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 = ''; // 清空密码
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user