From af48a331bf1ec8d30cff7d411afcce37741cbede Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Sun, 16 Apr 2017 20:53:27 +0300 Subject: cmd: integrate invisible recaptcha into puppeth --- cmd/puppeth/wizard_faucet.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'cmd/puppeth/wizard_faucet.go') diff --git a/cmd/puppeth/wizard_faucet.go b/cmd/puppeth/wizard_faucet.go index 71d1c910b..f3fd7c2a1 100644 --- a/cmd/puppeth/wizard_faucet.go +++ b/cmd/puppeth/wizard_faucet.go @@ -71,7 +71,7 @@ func (w *wizard) deployFaucet() { // Accessing GitHub gists requires API authorization, retrieve it if infos.githubUser != "" { fmt.Println() - fmt.Printf("Reused previous (%s) GitHub API authorization (y/n)? (default = yes)\n", infos.githubUser) + fmt.Printf("Reuse previous (%s) GitHub API authorization (y/n)? (default = yes)\n", infos.githubUser) if w.readDefaultString("y") != "y" { infos.githubUser, infos.githubToken = "", "" } @@ -109,6 +109,29 @@ func (w *wizard) deployFaucet() { return } } + // Accessing the reCaptcha service requires API authorizations, request it + if infos.captchaToken != "" { + fmt.Println() + fmt.Println("Reuse previous reCaptcha API authorization (y/n)? (default = yes)") + if w.readDefaultString("y") != "y" { + infos.captchaToken, infos.captchaSecret = "", "" + } + } + if infos.captchaToken == "" { + // No previous authorization (or old one discarded) + fmt.Println() + fmt.Println("Enable reCaptcha protection against robots (y/n)? (default = no)") + if w.readDefaultString("n") == "y" { + // Captcha protection explicitly requested, read the site and secret keys + fmt.Println() + fmt.Printf("What is the reCaptcha site key to authenticate human users?\n") + infos.captchaToken = w.readString() + + fmt.Println() + fmt.Printf("What is the reCaptcha secret key to verify authentications? (won't be echoed)\n") + infos.captchaSecret = w.readPassword() + } + } // Figure out where the user wants to store the persistent data fmt.Println() if infos.node.datadir == "" { -- cgit