用户登录验证码与用户密码修改
This commit is contained in:
1 parent
2740a308a2
commit
e64e33cf0a
13 files changed
+213
-52
No files matched your search
@@ -288,4 +288,58 @@ class Index extends Base
|
||||
return json($data);
|
||||
}
|
||||
|
||||
|
||||
// 修改自己的密码
|
||||
public function editPassword($id)
|
||||
{
|
||||
$list['id'] = $id;
|
||||
|
||||
// 模板赋值
|
||||
$this->assign('list',$list);
|
||||
|
||||
// 渲染模板
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
// 保存新密码
|
||||
public function updatePassword($id)
|
||||
{
|
||||
// 获取表单数据
|
||||
$list = request()->post();
|
||||
|
||||
if($list['newpassword'] != $list['newpassword2'])
|
||||
{
|
||||
$data = ['msg'=>'两次密码输入不一致'];
|
||||
return json($data);
|
||||
}
|
||||
|
||||
// 获取用户名
|
||||
$serpassword = AD::where('id',$id)->value('password');
|
||||
|
||||
// 实例化加密类
|
||||
$md5 = new APR1_MD5();
|
||||
//验证密码
|
||||
$check = $md5->check($list['oldpassword'],$serpassword);
|
||||
|
||||
if(!$check)
|
||||
{
|
||||
$data=['msg'=>'旧密码错误','val'=>0];
|
||||
return json($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 更新密码
|
||||
$password = $md5->hash($list['newpassword']);
|
||||
$data = AD::update(['id'=>$id,'password'=>$password]);
|
||||
|
||||
|
||||
// 根据更新结果设置返回提示信息
|
||||
$data ? $data=['msg'=>'修改成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
|
||||
|
||||
// 返回信息
|
||||
return json($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{extend name="common@create" /}
|
||||
{block name="formaa"}
|
||||
<form action="/editpassword/{$list.id}" method="PUT" class="form form-horizontal" id="form-member-add">
|
||||
<table class="table table-border table-bordered table-bg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">修改密码</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="text-r" width="30%">旧密码:</th>
|
||||
<td><input name="oldpassword" id="oldpassword" class="input-text" type="password" autocomplete="off" placeholder="密码" tabindex="1" datatype="*6-16" nullmsg="请输入旧密码!" errormsg="4~16个字符,区分大小写!">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-r">新密码:</th>
|
||||
<td><input name="newpassword" id="newpassword" class="input-text" type="password" autocomplete="off" placeholder="设置密码" tabindex="2" datatype="*6-16" nullmsg="请输入您的新密码!" errormsg="4~16个字符,区分大小写!" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-r">再次输入新密码:</th>
|
||||
<td><input name="newpassword2" id="newpassword2" class="input-text" type="password" autocomplete="off" placeholder="确认新密码" tabindex="3" datatype="*" recheck="newpassword" nullmsg="请再输入一次新密码!" errormsg="您两次输入的新密码不一致!">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-success radius"><i class="icon-ok"></i> 确定</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
{/block}
|
||||
{block name="yanzheng"}
|
||||
<script type="text/javascript">
|
||||
|
||||
// 设置表单验证规则
|
||||
var myrules = {
|
||||
oldpassword:{
|
||||
required:true,
|
||||
},
|
||||
newpassword:{
|
||||
required:true,
|
||||
rangelength:[5,20]
|
||||
},
|
||||
newpassword2:{
|
||||
required:true,
|
||||
rangelength:[5,20]
|
||||
},
|
||||
};
|
||||
|
||||
// 设置表单提交方式
|
||||
var mytype = 'PUT';
|
||||
</script>
|
||||
{/block}
|
||||
@@ -0,0 +1,73 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript" src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
|
||||
<script type="text/javascript" src="http://libs.useso.com/js/respond.js/1.4.2/respond.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.bootcss.com/css3pie/2.0beta1/PIE_IE678.js"></script>
|
||||
<![endif]-->
|
||||
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /}
|
||||
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /}
|
||||
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/font/font-awesome.min.css" /}
|
||||
<!--[if IE 7]>
|
||||
<link href="http://www.bootcss.com/p/font-awesome/assets/css/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
|
||||
<![endif]-->
|
||||
<title>修改密码</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="pd-20">
|
||||
<form class="Huiform" id="loginform" action="editpassword/{$list.id}" method="put">
|
||||
<table class="table table-border table-bordered table-bg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">修改密码</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="text-r" width="30%">旧密码:</th>
|
||||
<td><input name="oldpassword" id="oldpassword" class="input-text" type="password" autocomplete="off" placeholder="密码" tabindex="1" datatype="*6-16" nullmsg="请输入旧密码!" errormsg="4~16个字符,区分大小写!">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-r">新密码:</th>
|
||||
<td><input name="newpassword" id="newpassword" class="input-text" type="password" autocomplete="off" placeholder="设置密码" tabindex="2" datatype="*6-16" nullmsg="请输入您的新密码!" errormsg="4~16个字符,区分大小写!" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-r">再次输入新密码:</th>
|
||||
<td><input name="newpassword2" id="newpassword2" class="input-text" type="password" autocomplete="off" placeholder="确认新密码" tabindex="3" datatype="*" recheck="newpassword" nullmsg="请再输入一次新密码!" errormsg="您两次输入的新密码不一致!">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-success radius"><i class="icon-ok"></i> 确定</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/Validform_v5.3.2_min.js"></script>
|
||||
<script type="text/javascript" src="layer/layer.min.js"></script>
|
||||
<script type="text/javascript" src="js/H-ui.js"></script>
|
||||
<script type="text/javascript" src="js/H-ui.admin.js"></script>
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.js"}
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"}
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"}
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"}
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/jquery.validate.js"}
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/validate-methods.js"}
|
||||
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/messages_zh.js"}
|
||||
<script type="text/javascript">
|
||||
$(".Huiform").Validform();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loaded 3 of 13 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user