Skip to content

Commit

Permalink
Merge pull request #2 from asundust/analysis-vQBveO
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
asundust authored Apr 9, 2021
2 parents b475a6a + 50b0649 commit 04e7a01
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
34 changes: 17 additions & 17 deletions src/Http/Controllers/DcatAuthCaptchaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function getLogin(Content $content)
break;
}

return $content->full()->body(view(DcatAuthCaptchaServiceProvider::instance()->getName() . '::' . $this->captchaProvider . '.' . $this->providerStyles[$this->captchaProvider][$this->captchaStyle], [
return $content->full()->body(view(DcatAuthCaptchaServiceProvider::instance()->getName().'::'.$this->captchaProvider.'.'.$this->providerStyles[$this->captchaProvider][$this->captchaStyle], [
'captchaAppid' => $this->captchaAppid,
'captchaStyle' => $this->captchaStyle,
'extConfig' => $extConfig,
Expand All @@ -193,7 +193,7 @@ private function getGeetestStatus(): array
'new_captcha' => 1,
'user_id' => '',
];
$url = 'http://api.geetest.com/register.php?' . http_build_query($params);
$url = 'http://api.geetest.com/register.php?'.http_build_query($params);
$response = $this->captchaHttp()->get($url);
$statusCode = $response->getStatusCode();
$contents = $response->getBody()->getContents();
Expand All @@ -214,7 +214,7 @@ private function getGeetestStatus(): array
*/
private function geetestSuccessProcess($challenge): array
{
$challenge = md5($challenge . $this->captchaSecret);
$challenge = md5($challenge.$this->captchaSecret);
$result = [
'success' => 1,
'gt' => $this->captchaAppid,
Expand All @@ -233,7 +233,7 @@ private function geetestFailProcess(): array
{
$rnd1 = md5(rand(0, 100));
$rnd2 = md5(rand(0, 100));
$challenge = $rnd1 . substr($rnd2, 0, 2);
$challenge = $rnd1.substr($rnd2, 0, 2);
$result = [
'success' => 0,
'gt' => $this->captchaAppid,
Expand All @@ -256,10 +256,10 @@ private function getVerify5Token()
{
$params = [
'appid' => $this->captchaAppid,
'timestamp' => now()->timestamp . '000',
'timestamp' => now()->timestamp.'000',
];
$params['signature'] = $this->getSignature($this->captchaSecret, $params);
$url = 'https://' . DcatAuthCaptchaServiceProvider::setting('host') . '/openapi/getToken?' . http_build_query($params);
$url = 'https://'.DcatAuthCaptchaServiceProvider::setting('host').'/openapi/getToken?'.http_build_query($params);
$response = $this->captchaHttp()->get($url);
$statusCode = $response->getStatusCode();
$contents = $response->getBody()->getContents();
Expand Down Expand Up @@ -350,12 +350,12 @@ private function captchaValidateDingxiang(Request $request)
$params = [
'appKey' => $this->captchaAppid,
'constId' => $tokenArr[1],
'sign' => md5($this->captchaSecret . $tokenArr[0] . $this->captchaSecret),
'sign' => md5($this->captchaSecret.$tokenArr[0].$this->captchaSecret),
'token' => $tokenArr[0],
];

$url = 'https://cap.dingxiang-inc.com/api/tokenVerify';
$response = $this->captchaHttp()->get($url . '?' . http_build_query($params));
$response = $this->captchaHttp()->get($url.'?'.http_build_query($params));
$statusCode = $response->getStatusCode();
$contents = $response->getBody()->getContents();

Expand Down Expand Up @@ -487,7 +487,7 @@ private function captchaValidateRecaptcha(Request $request)
'remoteip' => $request->ip(),
];

$url = rtrim(DcatAuthCaptchaServiceProvider::setting('domain') ?? 'https://recaptcha.net') . '/recaptcha/api/siteverify';
$url = rtrim(DcatAuthCaptchaServiceProvider::setting('domain') ?? 'https://recaptcha.net').'/recaptcha/api/siteverify';
$response = $this->captchaHttp()->post($url, [
'form_params' => $params,
]);
Expand Down Expand Up @@ -536,7 +536,7 @@ private function captchaValidateTencent(Request $request)
];

$url = 'https://ssl.captcha.qq.com/ticket/verify';
$response = $this->captchaHttp()->get($url . '?' . http_build_query($params));
$response = $this->captchaHttp()->get($url.'?'.http_build_query($params));
$statusCode = $response->getStatusCode();
$contents = $response->getBody()->getContents();

Expand Down Expand Up @@ -570,10 +570,10 @@ public function captchaValidateVerify5(Request $request)
'host' => DcatAuthCaptchaServiceProvider::setting('host'),
'verifyid' => $token,
'token' => $verify5Token,
'timestamp' => now()->timestamp . '000',
'timestamp' => now()->timestamp.'000',
];
$params['signature'] = $this->getSignature($this->captchaSecret, $params);
$url = 'https://' . DcatAuthCaptchaServiceProvider::setting('host') . '/openapi/verify?' . http_build_query($params);
$url = 'https://'.DcatAuthCaptchaServiceProvider::setting('host').'/openapi/verify?'.http_build_query($params);
$response = $this->captchaHttp()->get($url);
$statusCode = $response->getStatusCode();
$contents = $response->getBody()->getContents();
Expand Down Expand Up @@ -652,7 +652,7 @@ private function captchaValidateWangyi(Request $request)
'user' => '',
'secretId' => $this->captchaSecret,
'version' => 'v2',
'timestamp' => now()->timestamp . '000',
'timestamp' => now()->timestamp.'000',
'nonce' => Str::random(),
];

Expand Down Expand Up @@ -705,7 +705,7 @@ private function captchaValidateYunpian(Request $request)
'secretId' => $this->captchaSecret,
'user' => '',
'version' => '1.0',
'timestamp' => now()->timestamp . '000',
'timestamp' => now()->timestamp.'000',
'nonce' => Str::random(),
];

Expand Down Expand Up @@ -741,7 +741,7 @@ public function getSignature($secretKey, $params): string
ksort($params);
$str = '';
foreach ($params as $key => $value) {
$str .= $key . $value;
$str .= $key.$value;
}
$str .= $secretKey;

Expand All @@ -756,7 +756,7 @@ public function getSignature($secretKey, $params): string
private function loginValidate(Request $request)
{
$credentials = $request->only([$this->username(), 'password']);
$remember = (bool)$request->input('remember', false);
$remember = (bool) $request->input('remember', false);

/** @var \Illuminate\Validation\Validator $validator */
$validator = Validator::make($credentials, [
Expand Down Expand Up @@ -796,7 +796,7 @@ private function captchaHttp(): Client
*/
private function toTrans($type): ?string
{
return DcatAuthCaptchaServiceProvider::trans('dcat-auth-captcha.messages.' . $type);
return DcatAuthCaptchaServiceProvider::trans('dcat-auth-captcha.messages.'.$type);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ public function form()
];

$documentHelp = $this->toTrans('parameters_document');
$documentAddress = ' <a href="https://github.com/asundust/dcat-auth-captcha/blob/master/README.md#%E8%8E%B7%E5%8F%96%E5%AF%86%E9%92%A5%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE" target="_blank">' . $this->toTrans('document_address') . '</a>';
$documentAddress = ' <a href="https://github.com/asundust/dcat-auth-captcha/blob/master/README.md#%E8%8E%B7%E5%8F%96%E5%AF%86%E9%92%A5%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE" target="_blank">'.$this->toTrans('document_address').'</a>';

$this->select('provider', $this->toTrans('provider'))
->options($providers)
->required();
$this->text('appid', $this->toTrans('appid'))->required();
$this->text('secret', $this->toTrans('secret'))->required();
$this->text('style', $this->toTrans('style'))
->help($documentHelp . $documentAddress);
->help($documentHelp.$documentAddress);
$this->text('secret_key', $this->toTrans('secret_key'))
->help($documentHelp . $documentAddress);
->help($documentHelp.$documentAddress);
$this->text('host', $this->toTrans('host'))
->help($documentHelp . $documentAddress);
->help($documentHelp.$documentAddress);
$this->text('domain', $this->toTrans('domain'))
->help($documentHelp . $documentAddress);
->help($documentHelp.$documentAddress);
$this->text('score', $this->toTrans('score'))
->help($documentHelp . $documentAddress);
->help($documentHelp.$documentAddress);
$this->textarea('ext_config', $this->toTrans('ext_config'))
->help($this->toTrans('tip_json'));
}
Expand All @@ -53,6 +53,6 @@ public function form()
*/
public function toTrans($key): string
{
return $this->trans('dcat-auth-captcha.' . $key);
return $this->trans('dcat-auth-captcha.'.$key);
}
}

0 comments on commit 04e7a01

Please sign in to comment.