From 748e4acfb699ab9fd207e9898e28c7ca59a344fd Mon Sep 17 00:00:00 2001 From: cnone Date: Sun, 19 May 2019 17:31:25 +0300 Subject: [PATCH] Fix empty json auth parameter bug --- cmd/config.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index 3812d692..59ad9bfd 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -70,12 +70,14 @@ func getAuthentication(flags *pflag.FlagSet, defaults ...*settings.Settings) (se key := mustGetString(flags, "recaptcha.key") secret := mustGetString(flags, "recaptcha.secret") - if key != "" && secret != "" { - jsonAuth.ReCaptcha = &auth.ReCaptcha{ - Host: host, - Key: key, - Secret: secret, - } + if key == "" || secret == "" { + panic(nerrors.New("you must set the flag 'recaptcha.key' and 'recaptcha.secret' for method 'json'")) + } + + jsonAuth.ReCaptcha = &auth.ReCaptcha{ + Host: host, + Key: key, + Secret: secret, } auther = jsonAuth