|
@@ -21,6 +21,23 @@ class Login extends BaseController
|
|
|
|
|
|
public function check()
|
|
|
{
|
|
|
+ if (!$this->request->isPost()) {
|
|
|
+ return show(config('status.error'), '请求方式错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 参数校验 1、原生方式 2、TP6 验证机制
|
|
|
+ $username = $this->request->param('username', '', 'trim');
|
|
|
+ $password = $this->request->param('password', '', 'trim');
|
|
|
+ $captcha = $this->request->param('captcha', '', 'trim');
|
|
|
+ if (empty($username) || empty($password) || empty($captcha)) {
|
|
|
+ return show(config('status.error'), '参数不能为空');
|
|
|
+ }
|
|
|
+ // 验证码校验
|
|
|
+ if (!captcha_check($captcha)) {
|
|
|
+ // 验证码校验失败
|
|
|
+ return show(config('status.error'), '验证码不正确');
|
|
|
+ }
|
|
|
+
|
|
|
return show(config('status.success'), '登陆成功');
|
|
|
}
|
|
|
}
|