Fix empty json auth parameter bug

pull/732/head
cnone 2019-05-19 17:31:25 +03:00
parent 6e48a6b512
commit 748e4acfb6
1 changed files with 8 additions and 6 deletions

View File

@ -70,13 +70,15 @@ func getAuthentication(flags *pflag.FlagSet, defaults ...*settings.Settings) (se
key := mustGetString(flags, "recaptcha.key") key := mustGetString(flags, "recaptcha.key")
secret := mustGetString(flags, "recaptcha.secret") secret := mustGetString(flags, "recaptcha.secret")
if key != "" && secret != "" { if key == "" || secret == "" {
panic(nerrors.New("you must set the flag 'recaptcha.key' and 'recaptcha.secret' for method 'json'"))
}
jsonAuth.ReCaptcha = &auth.ReCaptcha{ jsonAuth.ReCaptcha = &auth.ReCaptcha{
Host: host, Host: host,
Key: key, Key: key,
Secret: secret, Secret: secret,
} }
}
auther = jsonAuth auther = jsonAuth
} }