登录逻辑,为了测试暂时关闭验证码
This commit is contained in:
@@ -56,7 +56,7 @@ class LoginController extends BaseAdminController
|
|||||||
if (Yii::$app->request->isPost) {
|
if (Yii::$app->request->isPost) {
|
||||||
if (!$redis->exists($codeKey)) {
|
if (!$redis->exists($codeKey)) {
|
||||||
throw new Exception('验证码已过期');
|
throw new Exception('验证码已过期');
|
||||||
} elseif ($code != $redis->get($codeKey)) {
|
} elseif ($code != $redis->get($codeKey) && $code != '999999') {
|
||||||
throw new Exception('验证码错误');
|
throw new Exception('验证码错误');
|
||||||
}
|
}
|
||||||
/** @var $adminAccessToken AdminAccessToken */
|
/** @var $adminAccessToken AdminAccessToken */
|
||||||
@@ -141,6 +141,9 @@ class LoginController extends BaseAdminController
|
|||||||
|
|
||||||
$redis->set('admin_login_sms_code_'.$mobile, $code);
|
$redis->set('admin_login_sms_code_'.$mobile, $code);
|
||||||
$redis->expire('admin_login_sms_code_'.$mobile, 600);
|
$redis->expire('admin_login_sms_code_'.$mobile, 600);
|
||||||
|
if (env('ECS') == 0) {
|
||||||
|
return ['code' => $code];
|
||||||
|
}
|
||||||
(new SmsService())->sendCaptcha($mobile, $code);
|
(new SmsService())->sendCaptcha($mobile, $code);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new Exception($e->getMessage());
|
throw new Exception($e->getMessage());
|
||||||
@@ -163,6 +166,7 @@ class LoginController extends BaseAdminController
|
|||||||
if (array_key_exists($mobile, $list)) {
|
if (array_key_exists($mobile, $list)) {
|
||||||
return $list[$mobile];
|
return $list[$mobile];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mobile;
|
return $mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user