admin pass

This commit is contained in:
toogee 2020-09-23 12:28:49 +08:00
parent ea760897cd
commit 6fd4c19a4d
5 changed files with 12 additions and 11 deletions

View File

@ -76,7 +76,8 @@ class Admin extends AdminController
$data = Request::param(); $data = Request::param();
$data['create_time'] = time(); $data['create_time'] = time();
$salt = substr(md5($data['create_time']),-6); $salt = substr(md5($data['create_time']),-6);
$data['password'] = substr_replace(md5($data['password']),$salt,0,6); $data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6));
$data['status'] = 1;
//$adminId = Db::name('admin')->insertGetId($data); //$adminId = Db::name('admin')->insertGetId($data);
$admin = Db::name('admin')->save($data); $admin = Db::name('admin')->save($data);
//Db::name('auth_group_access')->insert(['uid'=>$adminId,'group_id'=>$data['auth_group_id']]); //Db::name('auth_group_access')->insert(['uid'=>$adminId,'group_id'=>$data['auth_group_id']]);

View File

@ -25,7 +25,7 @@ class Admin extends Model
public function login($data) public function login($data)
{ {
//查询用户 //查询用户
$admin = Db::name('admin')->where('username',$data['username'])->find(); $admin = Db::name('admin')->where('username',$data['username'])->where('delete_time',0)->find();
if($admin['status'] !=1){ if($admin['status'] !=1){
return '用户被禁用或未审核,请联系管理员'; return '用户被禁用或未审核,请联系管理员';

View File

@ -9,6 +9,12 @@
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input"> <input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div> </div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-inline">
<input type="text" name="password" lay-verify="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
</div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">手机</label> <label class="layui-form-label">手机</label>
@ -22,12 +28,6 @@
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input"> <input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">审核状态</label>
<div class="layui-input-inline">
<input type="checkbox" lay-filter="switch" name="status" lay-skin="switch" lay-text="通过|待审核">
</div>
</div>
<div class="layui-form-item layui-hide"> <div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认"> <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div> </div>

View File

@ -194,7 +194,7 @@
type: 2 type: 2
,title: '添加管理员' ,title: '添加管理员'
,content: 'add.html' ,content: 'add.html'
,area: ['420px', '420px'] ,area: ['400px', '380px']
,btn: ['确定', '取消'] ,btn: ['确定', '取消']
,yes: function(index, layero){ ,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index] var iframeWindow = window['layui-layer-iframe'+ index]
@ -209,7 +209,7 @@
$.ajax({ $.ajax({
type:"post", type:"post",
url:"{:url('admin/admin/add')}", url:"{:url('admin/admin/add')}",
data:{"username":field.username,"password":field.username,"mobile":field.mobile,"email":field.email,"auth_group_id":field.auth_group_id,"status":field.status}, data:{"username":field.username,"password":field.password,"mobile":field.mobile,"email":field.email,"auth_group_id":field.auth_group_id,"status":field.status},
daType:"json", daType:"json",
success:function (data){ success:function (data){
if (data.code == 0) { if (data.code == 0) {

View File

@ -330,7 +330,7 @@ CREATE TABLE `tao_system` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='系统配置表'; ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='系统配置表';
INSERT INTO `tao_system` VALUES ('1', 'TaoLer社区演示站', '轻论坛系统', 'http://www.xxx.com', 'taoler', '/storage/logo/logo.png', '10', '2048', 'png|gif|jpg|jpeg|zip|rarr', '<a href=\"http://www.aieok.com\" target=\"_blank\">aieok.com 版权所有</a>', 'TaoLer,轻社区系统,bbs,论坛,Thinkphp6,layui,fly模板,', '这是一个Taoler轻社区论坛系统', '1', '1', '1', '0.0.0.0', '管理员|admin|审核员|超级|垃圾', '1.5.1', '', 'http://api.aieok.com/v1/index/cy', 'http://api.aieok.com/v1/upload/check', 'http://api.aieok.com/v1/upload/api', '1581221008', '1577419197'); INSERT INTO `tao_system` VALUES ('1', 'TaoLer社区演示站', '轻论坛系统', 'http://www.xxx.com', 'taoler', '/storage/logo/logo.png', '10', '2048', 'png|gif|jpg|jpeg|zip|rarr', '<a href=\"http://www.aieok.com\" target=\"_blank\">aieok.com 版权所有</a>', 'TaoLer,轻社区系统,bbs,论坛,Thinkphp6,layui,fly模板,', '这是一个Taoler轻社区论坛系统', '1', '1', '1', '0.0.0.0', '管理员|admin|审核员|超级|垃圾', '1.5.2', '', 'http://api.aieok.com/v1/index/cy', 'http://api.aieok.com/v1/upload/check', 'http://api.aieok.com/v1/upload/api', '1581221008', '1577419197');
DROP TABLE IF EXISTS `tao_user`; DROP TABLE IF EXISTS `tao_user`;