用户密码验证
This commit is contained in:
1 parent
a77ff68b09
commit
a65e23d830
21 files changed
+503
-23
No files matched your search
@@ -8,11 +8,11 @@ use app\common\controller\Base;
|
||||
class Index extends Base
|
||||
{
|
||||
|
||||
// /**
|
||||
// * 操作成功跳转
|
||||
// *
|
||||
// * @return \think\Response
|
||||
// */
|
||||
/**
|
||||
* 操作成功跳转
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function mysuccess($msg = '操作成功~')
|
||||
{
|
||||
// 模版赋值
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if( window.top == window.self ){
|
||||
// location.href = "/";
|
||||
$('#hrel').html("您可以:<<a href='javascript:;' onclick='topurl()' class='ml-20 c-primary'> 去首页</a>\
|
||||
<span class='ml-10 mr-10'>|</span><a href='javascript:;' onclick='lasturl()'\ class='c-primary mr-20'>返回上一页</a>\
|
||||
<span class='ml-10 mr-10'>|</span><a href='javascript:;' onclick='loginurl()'\ class='c-primary mr-20'>登录页面</a>\
|
||||
>");
|
||||
}else{
|
||||
// removeIframe();
|
||||
@@ -57,14 +57,14 @@
|
||||
// 跳转到首页
|
||||
function topurl()
|
||||
{
|
||||
location.href = "/";
|
||||
location.href = "/";
|
||||
}
|
||||
|
||||
|
||||
// 跳转到上一页
|
||||
function lasturl()
|
||||
function loginurl()
|
||||
{
|
||||
location.href = "history.go(-1)";
|
||||
location.href = '/login';
|
||||
}
|
||||
|
||||
// 关闭页面
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loaded 3 of 21 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user