up.
This commit is contained in:
parent
18d0d9fef9
commit
ab9af25691
@ -3,6 +3,9 @@
|
|||||||
namespace app\controller\admin\auth;
|
namespace app\controller\admin\auth;
|
||||||
|
|
||||||
use app\BaseController;
|
use app\BaseController;
|
||||||
|
use app\entity\SysUser;
|
||||||
|
use app\enum\UserTypeEnum;
|
||||||
|
use app\http\HttpAuth;
|
||||||
use app\service\admin\LoginService;
|
use app\service\admin\LoginService;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
|
|
||||||
@ -18,6 +21,7 @@ class LoginController extends BaseController
|
|||||||
'text' => $captchaData['data']['text'] ?? '',
|
'text' => $captchaData['data']['text'] ?? '',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$username = $this->request->post('username', '');
|
$username = $this->request->post('username', '');
|
||||||
@ -28,6 +32,10 @@ class LoginController extends BaseController
|
|||||||
$loginService = new LoginService();
|
$loginService = new LoginService();
|
||||||
try {
|
try {
|
||||||
$result = $loginService->login($this->request, $this->request->getClient(), $username, $password, $code, $remember);
|
$result = $loginService->login($this->request, $this->request->getClient(), $username, $password, $code, $remember);
|
||||||
|
// 绑定Auth
|
||||||
|
$this->request->setAuth(new HttpAuth($result['user']['userId'], UserTypeEnum::USER));
|
||||||
|
|
||||||
|
security_log_record([SysUser::class, "userLogin"], "{$username}登录了系统", '');
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException $e) {
|
||||||
return $this->writeError($e->getError());
|
return $this->writeError($e->getError());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,6 @@ class ContextMiddleware extends middleware
|
|||||||
$log = (array)$this->app->config->get('admin.httpLog');
|
$log = (array)$this->app->config->get('admin.httpLog');
|
||||||
|
|
||||||
$logOpen = $log['open'] ?? false;
|
$logOpen = $log['open'] ?? false;
|
||||||
$logOpen = false;
|
|
||||||
if (!$logOpen || in_array($request->method() . '@' . $request->pathinfo(),$this->noHttpLog)) {
|
if (!$logOpen || in_array($request->method() . '@' . $request->pathinfo(),$this->noHttpLog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,6 +81,7 @@ class LoginService
|
|||||||
'ip' => $request->ip(),
|
'ip' => $request->ip(),
|
||||||
'comments' => $comments,
|
'comments' => $comments,
|
||||||
'login_type' => $loginType->value,
|
'login_type' => $loginType->value,
|
||||||
|
'context_id' => $request->contextId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ return [
|
|||||||
'open_start_time' => 0,
|
'open_start_time' => 0,
|
||||||
'open_end_time' => 0,
|
'open_end_time' => 0,
|
||||||
'recordRules' => [
|
'recordRules' => [
|
||||||
'include_methods' => ['GET', 'POST', 'PUT', 'DELETE'],
|
'include_methods' => ['POST', 'PUT', 'DELETE'],
|
||||||
'include_responses' => [Json::class],
|
'include_responses' => [Json::class],
|
||||||
'include_codes' => [],
|
'include_codes' => [],
|
||||||
'exclude_codes' => [],
|
'exclude_codes' => [],
|
||||||
|
|||||||
@ -52,9 +52,7 @@
|
|||||||
Columns
|
Columns
|
||||||
} from 'ele-admin-plus/es/ele-pro-table/types';
|
} from 'ele-admin-plus/es/ele-pro-table/types';
|
||||||
import LoginRecordSearch from './components/login-record-search.vue';
|
import LoginRecordSearch from './components/login-record-search.vue';
|
||||||
import {
|
import { pageLoginRecords } from '@/api/system/login-record';
|
||||||
pageLoginRecords,
|
|
||||||
} from '@/api/system/login-record';
|
|
||||||
import type { LoginRecordParam } from '@/api/system/login-record/model';
|
import type { LoginRecordParam } from '@/api/system/login-record/model';
|
||||||
|
|
||||||
defineOptions({ name: 'SystemLoginRecord' });
|
defineOptions({ name: 'SystemLoginRecord' });
|
||||||
@ -76,6 +74,11 @@
|
|||||||
width: 50,
|
width: 50,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'contextId',
|
||||||
|
label: 'ContextId',
|
||||||
|
width: 280
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'username',
|
prop: 'username',
|
||||||
label: '账号',
|
label: '账号',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user