From 624f1e4b0cc216a0a8d1fed91a5edd2cbe79424f Mon Sep 17 00:00:00 2001 From: shinn-lancelot <945226793@qq.com> Date: Wed, 12 Sep 2018 22:29:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AE=A1=E7=90=86=E5=91=98=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=9A=90=E8=94=BDbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modifyPasswordHandle.php | 9 +++++++++ modifyPassword.php | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/common/modifyPasswordHandle.php b/common/modifyPasswordHandle.php index 037ac70..61d7684 100644 --- a/common/modifyPasswordHandle.php +++ b/common/modifyPasswordHandle.php @@ -4,6 +4,15 @@ $res['code'] = 0; $res['message'] = '修改失败!'; + session_start(); + $user = isset($_SESSION['wop_admin_user']) ? $_SESSION['wop_admin_user'] : ''; + if (empty($user)) { + $res['code'] = -1; + $res['message'] = '登陆过期!'; + echo json_encode($res); + exit(); + } + $user = isset($_POST['user']) ? $_POST['user'] : ''; $oldPassword = isset($_POST['old_password']) ? strip_tags(trim($_POST['old_password'])) : ''; $newPassword = isset($_POST['new_password']) ? strip_tags(trim($_POST['new_password'])) : ''; diff --git a/modifyPassword.php b/modifyPassword.php index bb3efd8..ca983eb 100644 --- a/modifyPassword.php +++ b/modifyPassword.php @@ -298,11 +298,13 @@ if (xhr.readyState == 4) { responseObj = JSON.parse(xhr.response); alert(responseObj.message); - if (responseObj.code == 1) { - setTimeout(function() { - window.location.href = './admin.php'; - }, 500); - } else { + responseObj.code == 1 && setTimeout(function() { + window.location.href = './admin.php'; + }, 500); + responseObj.code == -1 && setTimeout(function() { + window.location.href = './login.php'; + }, 500); + if (responseObj.code != -1) { submitState = 1; } } else {