Skip to content

Commit

Permalink
1. 修复后台修改管理员密码隐蔽bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shinn-lancelot committed Sep 12, 2018
1 parent c603d7c commit 624f1e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions common/modifyPasswordHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) : '';
Expand Down
12 changes: 7 additions & 5 deletions modifyPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 624f1e4

Please sign in to comment.