mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
更新系统模块
This commit is contained in:
parent
b28798ff31
commit
c74de1fa24
@ -15,8 +15,10 @@
|
||||
namespace app\admin\controller;
|
||||
|
||||
use controller\BasicAdmin;
|
||||
use library\Data;
|
||||
use library\Tools;
|
||||
use think\Db;
|
||||
use think\response\View;
|
||||
|
||||
/**
|
||||
* 后台入口
|
||||
@ -29,7 +31,7 @@ class Index extends BasicAdmin {
|
||||
|
||||
/**
|
||||
* 后台框架布局
|
||||
* @return \think\response\View
|
||||
* @return View
|
||||
*/
|
||||
public function index() {
|
||||
$list = Db::name('SystemMenu')->field('title,id,pid,url,icon')->order('sort asc,id asc')->where('status', '1')->select();
|
||||
@ -64,7 +66,7 @@ class Index extends BasicAdmin {
|
||||
|
||||
/**
|
||||
* 主机信息显示
|
||||
* @return \think\response\View
|
||||
* @return View
|
||||
*/
|
||||
public function main() {
|
||||
$_version = Db::query('select version() as ver');
|
||||
@ -82,4 +84,42 @@ class Index extends BasicAdmin {
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
public function pass() {
|
||||
if (intval($this->request->request('id')) !== intval(session('user.id'))) {
|
||||
$this->error('访问异常!');
|
||||
}
|
||||
if ($this->request->isGet()) {
|
||||
$this->assign('verify', true);
|
||||
return $this->_form('SystemUser', 'user/pass');
|
||||
} else {
|
||||
$data = $this->request->post();
|
||||
if ($data['password'] !== $data['repassword']) {
|
||||
$this->error('两次输入的密码不一致,请重新输入!');
|
||||
}
|
||||
$user = Db::name('SystemUser')->where('id', session('user.id'))->find();
|
||||
if (md5($data['oldpassword']) !== $user['password']) {
|
||||
$this->error('旧密码验证失败,请重新输入!');
|
||||
}
|
||||
if (Data::save('SystemUser', ['id' => session('user.id'), 'password' => md5($data['password'])])) {
|
||||
$this->success('密码修改成功,下次请使用新密码登录!', '');
|
||||
} else {
|
||||
$this->error('密码修改失败,请稍候再试!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资料
|
||||
*/
|
||||
public function info() {
|
||||
if (intval($this->request->request('id')) === intval(session('user.id'))) {
|
||||
return $this->_form('SystemUser', 'user/form');
|
||||
} else {
|
||||
$this->error('访问异常!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,17 +11,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $verify}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">登录密码</label>
|
||||
<label class="layui-form-label">旧的密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password" value='' pattern="^\S{1,}$" required="" title="请输入登录密码" placeholder="请输入登录密码" class="layui-input">
|
||||
<input type="password" name="oldpassword" value='' pattern="^\S{1,}$" required="" title="请输入旧的密码" placeholder="请输入旧的密码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新的密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password" value='' pattern="^\S{1,}$" required="" title="请输入新的密码" placeholder="请输入新的密码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">重复密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="repassword" value='' pattern="^\S{1,}$" required="" title="请输入重复密码" placeholder="请输入重复密码" class="layui-input">
|
||||
<input type="password" name="repassword" value='' pattern="^\S{1,}$" required="" title="请输入重复密码" placeholder="请输入重复密码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user