forked from FoundKeyGang/FoundKey
refactor
This commit is contained in:
parent
ca6a70e555
commit
9053b9635e
1 changed files with 18 additions and 15 deletions
|
@ -12,7 +12,8 @@ export default async (ctx: Koa.Context) => {
|
||||||
|
|
||||||
// Verify *Captcha
|
// Verify *Captcha
|
||||||
// ただしテスト時はこの機構は障害となるため無効にする
|
// ただしテスト時はこの機構は障害となるため無効にする
|
||||||
if (process.env.NODE_ENV !== 'test' && instance.enableHcaptcha && instance.hcaptchaSecretKey) {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
|
if (instance.enableHcaptcha && instance.hcaptchaSecretKey) {
|
||||||
const success = await verify(instance.hcaptchaSecretKey, body['hcaptcha-response']).then(
|
const success = await verify(instance.hcaptchaSecretKey, body['hcaptcha-response']).then(
|
||||||
({ success }) => success,
|
({ success }) => success,
|
||||||
() => false,
|
() => false,
|
||||||
|
@ -22,7 +23,8 @@ export default async (ctx: Koa.Context) => {
|
||||||
ctx.throw(400, 'hcaptcha-failed');
|
ctx.throw(400, 'hcaptcha-failed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV !== 'test' && instance.enableRecaptcha && instance.recaptchaSecretKey) {
|
|
||||||
|
if (instance.enableRecaptcha && instance.recaptchaSecretKey) {
|
||||||
recaptcha.init({
|
recaptcha.init({
|
||||||
secret_key: instance.recaptchaSecretKey
|
secret_key: instance.recaptchaSecretKey
|
||||||
});
|
});
|
||||||
|
@ -33,6 +35,7 @@ export default async (ctx: Koa.Context) => {
|
||||||
ctx.throw(400, 'recaptcha-failed');
|
ctx.throw(400, 'recaptcha-failed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const username = body['username'];
|
const username = body['username'];
|
||||||
const password = body['password'];
|
const password = body['password'];
|
||||||
|
|
Loading…
Reference in a new issue