summaryrefslogtreecommitdiff
path: root/src/server/api
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-05-02 10:28:45 +0900
committerGitHub <noreply@github.com>2020-05-02 10:28:45 +0900
commit9053b9635e1b2f1daf233f644d6f8f3bb8411cc0 (patch)
tree6d6547f02b25d4045cec4b191b2b8d9d7cc9fe25 /src/server/api
parentUpdate signup.vue (diff)
downloadsharkey-9053b9635e1b2f1daf233f644d6f8f3bb8411cc0.tar.gz
sharkey-9053b9635e1b2f1daf233f644d6f8f3bb8411cc0.tar.bz2
sharkey-9053b9635e1b2f1daf233f644d6f8f3bb8411cc0.zip
refactor
Diffstat (limited to 'src/server/api')
-rw-r--r--src/server/api/private/signup.ts33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts
index 04d0501b6c..4e475e1982 100644
--- a/src/server/api/private/signup.ts
+++ b/src/server/api/private/signup.ts
@@ -12,25 +12,28 @@ export default async (ctx: Koa.Context) => {
// Verify *Captcha
// ただしテスト時はこの機構は障害となるため無効にする
- if (process.env.NODE_ENV !== 'test' && instance.enableHcaptcha && instance.hcaptchaSecretKey) {
- const success = await verify(instance.hcaptchaSecretKey, body['hcaptcha-response']).then(
- ({ success }) => success,
- () => false,
- );
+ if (process.env.NODE_ENV !== 'test') {
+ if (instance.enableHcaptcha && instance.hcaptchaSecretKey) {
+ const success = await verify(instance.hcaptchaSecretKey, body['hcaptcha-response']).then(
+ ({ success }) => success,
+ () => false,
+ );
- if (!success) {
- ctx.throw(400, 'hcaptcha-failed');
+ if (!success) {
+ ctx.throw(400, 'hcaptcha-failed');
+ }
}
- }
- if (process.env.NODE_ENV !== 'test' && instance.enableRecaptcha && instance.recaptchaSecretKey) {
- recaptcha.init({
- secret_key: instance.recaptchaSecretKey
- });
- const success = await recaptcha(body['g-recaptcha-response']);
+ if (instance.enableRecaptcha && instance.recaptchaSecretKey) {
+ recaptcha.init({
+ secret_key: instance.recaptchaSecretKey
+ });
+
+ const success = await recaptcha(body['g-recaptcha-response']);
- if (!success) {
- ctx.throw(400, 'recaptcha-failed');
+ if (!success) {
+ ctx.throw(400, 'recaptcha-failed');
+ }
}
}