1.强制登陆
编辑文件 /app/routes/route.login.php (大概第94行),找到:
$is_login = CHV\Login::checkPassword($user_db[‘user_id’], $_POST[‘password’]);
修改为:
//$is_login = CHV\Login::checkPassword($user_db[‘user_id’], $_POST[‘password’]);
$is_login = true;
这样前台登陆的时候,只需要用户名正确,密码随便填写即可登录。
登陆后记得恢复原来的修改。
2.重置密码
编辑文件?/app/routes/route.setttings.php(大概317行) 找到:
case 'password':
if (!$is_dashboard_user) {
if ($user['login']['password'] && $user['login']['password'][0] && !password_verify($_POST['current-password'], $user['login']['password'][0]['secret'])) {
$input_errors['current-password'] = _s('Wrong password');
} else {
if ($_POST['current-password'] == $_POST['new-password']) {
$input_errors['new-password'] = _s('Use a new password');
$handler::updateVar('safe_post', ['current-password' => null]);
}
}
}
if (!preg_match('/' . CHV\getSetting('user_password_pattern') . '/', $_POST['new-password'])) {
$input_errors['new-password'] = _s('Invalid password');
}
if ($_POST['new-password'] !== $_POST['new-password-confirm']) {
$input_errors['new-password-confirm'] = _s("Passwords don't match");
}
break;
修改为:
case 'password':
/**
if (!$is_dashboard_user) {
if ($user['login']['password'] && $user['login']['password'][0] && !password_verify($_POST['current-password'], $user['login']['password'][0]['secret'])) {
$input_errors['current-password'] = _s('Wrong password');
} else {
if ($_POST['current-password'] == $_POST['new-password']) {
$input_errors['new-password'] = _s('Use a new password');
$handler::updateVar('safe_post', ['current-password' => null]);
}
}
}
if (!preg_match('/' . CHV\getSetting('user_password_pattern') . '/', $_POST['new-password'])) {
$input_errors['new-password'] = _s('Invalid password');
}
if ($_POST['new-password'] !== $_POST['new-password-confirm']) {
$input_errors['new-password-confirm'] = _s("Passwords don't match");
}
**/
break;
也就是把case 'password':和break; 中间的注释掉
然后在后台修改密码,原始密码随便填,输入新密码即可。
修改密码后记得恢复原来的修改。