用户登录验证码与用户密码修改
This commit is contained in:
1 parent
2740a308a2
commit
e64e33cf0a
13 files changed
+213
-52
No files matched your search
@@ -5,9 +5,10 @@ namespace app\login\controller;
|
||||
use think\Controller;
|
||||
// 引用用户数据模型
|
||||
use app\admin\model\Admin as AD;
|
||||
|
||||
// 引用加密类
|
||||
use WhiteHat101\Crypt\APR1_MD5;
|
||||
// 引用Session类
|
||||
use \think\facade\Session;
|
||||
|
||||
|
||||
class Index extends Controller
|
||||
@@ -29,8 +30,9 @@ class Index extends Controller
|
||||
|
||||
|
||||
// 获取表单数据
|
||||
$data = request()->only(['username','password']);
|
||||
$data = request()->only(['username','password','captcha']);
|
||||
|
||||
|
||||
// 验证表单数据
|
||||
$result = $validate->check($data);
|
||||
$msg = $validate->getError();
|
||||
@@ -38,6 +40,11 @@ class Index extends Controller
|
||||
$this->error($msg);
|
||||
}
|
||||
|
||||
if(!captcha_check($data['captcha']))
|
||||
{
|
||||
$this->error('验证码错误');
|
||||
}
|
||||
|
||||
|
||||
// 验证用户名和密码
|
||||
$check = $this->check($data['username'],$data['password']);
|
||||
@@ -109,23 +116,6 @@ class Index extends Controller
|
||||
}
|
||||
|
||||
|
||||
// 生成验证码
|
||||
public function verify()
|
||||
{
|
||||
$captcha = new \think\captcha\Captcha;
|
||||
return $captcha->entry();
|
||||
}
|
||||
|
||||
public function checkcaptcha($value)
|
||||
{
|
||||
dump($value);
|
||||
$captcha = new \think\captcha\Captcha;
|
||||
if( $captcha->check($value))
|
||||
{
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user