更新登录判断

This commit is contained in:
yaooo 2023-10-27 15:05:31 +08:00
parent 44916e28c6
commit 2c8ca061de
3 changed files with 4 additions and 17 deletions

View File

@ -98,15 +98,9 @@ abstract class BaseController
{ {
$session_admin = get_config('app.session_admin'); $session_admin = get_config('app.session_admin');
$header = Request::header(); $header = Request::header();
$token = $header['token'] ?? '';
// 取消登录验证 // 取消登录验证
if ($this->action != 'login') { if (!Session::has($session_admin)) {
if (!Session::has($session_admin) || !$token) { $this->apiError('用户未登录');
$this->apiError('用户未登录');
}
}
if ($token) {
} }
if (Session::has($session_admin)) { if (Session::has($session_admin)) {
$this->uid = Session::get($session_admin); $this->uid = Session::get($session_admin);

View File

@ -264,13 +264,6 @@ class Index extends BaseController
public function edit_password() public function edit_password()
{ {
if (request()->isAjax()) { if (request()->isAjax()) {
//下面部分代码可删除--------------
if($_SERVER['HTTP_HOST']=='oa.gougucms.com'){
return to_assign(1, 'Bad Man为什么总想着改别人的密码已记录IP抓住你了');
}
//上面部分代码可删除--------------
$param = get_params(); $param = get_params();
try { try {
validate(AdminCheck::class)->scene('editPwd')->check($param); validate(AdminCheck::class)->scene('editPwd')->check($param);

View File

@ -50,7 +50,7 @@ class Login
'is_lock' => 0, 'is_lock' => 0,
'last_login_time' => time(), 'last_login_time' => time(),
'last_login_ip' => request()->ip(), 'last_login_ip' => request()->ip(),
'login_num' => $admin['login_num'] + 1 'login_num' => $admin['login_num'] + 1,
]; ];
Db::name('admin')->where(['id' => $admin['id']])->update($data); Db::name('admin')->where(['id' => $admin['id']])->update($data);
$session_admin = get_config('app.session_admin'); $session_admin = get_config('app.session_admin');
@ -106,4 +106,4 @@ class Login
Db::name('admin')->where('id',$admin['id'])->update(['is_lock'=>1]); Db::name('admin')->where('id',$admin['id'])->update(['is_lock'=>1]);
return View(); return View();
} }
} }