用户密码验证

This commit is contained in:
cxdbz committed 2018-10-15 22:45:54 +08:00
1 parent a77ff68b09
commit a65e23d830
21 files changed
+503 -23

No files matched your search

+27 -8
View File
@@ -5,6 +5,10 @@ namespace app\login\controller;
use think\Controller;
// 引用用户数据模型
use app\member\model\Member as membermod;
// 引用请求类
use think\facade\Request;
// 引用加密类
use WhiteHat101\Crypt\APR1_MD5;
class Index extends Controller
@@ -20,23 +24,38 @@ class Index extends Controller
// 登录验证
public function yanzheng()
{
// 实例化模型
$membermod = new membermod();
$list = request()->post();
// 实例化验证模型
$validate = new \app\login\validate\Yanzheng;
// 实例化加密类
$md5 = new APR1_MD5();
$data = request()->post();
// 获取表单数据
$data = request()->only(['username','password']);
// 验证表单数据
$result = $validate->check($data);
$msg = $validate->getError();
if(!$result){
$this->redirect('/notfound',[], 302, ['msg' => $msg]);
}
// return true;
// 重新计算密码
$miyao = $membermod->miyao('admin');
$data['password'] = $md5->hash($miyao,$data['password']);
// 验证用户名和密码
$list = $membermod->check($data);
if($list)
{
dump($list);
}else{
dump($list);
}
}
}