Fixed recaptcha issues and some grammar mistakes

This commit is contained in:
Parminder Singh 2018-03-10 16:11:45 +05:30
parent a3ff68c2b1
commit 773c8a8e4e

View file

@ -84,8 +84,8 @@ if (window.onAuthDone) {
</head> </head>
<body> <body>
<div> <div>
<p>Thank you</p> <p>Thank you!</p>
<p>You may now close this window and return to the application</p> <p>You may now close this window and return to the application.</p>
</div> </div>
</body> </body>
</html> </html>
@ -115,7 +115,7 @@ func AuthFallback(
data := map[string]string{ data := map[string]string{
"MyUrl": req.URL.String(), "MyUrl": req.URL.String(),
"Session": sessionID, "Session": sessionID,
"SiteKey": cfg.Matrix.RecaptchaPrivateKey, "SiteKey": cfg.Matrix.RecaptchaPublicKey,
} }
ServeTemplate(w, RecaptchaTemplate, data) ServeTemplate(w, RecaptchaTemplate, data)
} }
@ -128,8 +128,8 @@ func AuthFallback(
if req.Method == "GET" { if req.Method == "GET" {
// Handle Recaptcha // Handle Recaptcha
if authType == authtypes.LoginTypeRecaptcha { if authType == authtypes.LoginTypeRecaptcha {
if cfg.Matrix.RecaptchaPrivateKey == "" { if cfg.Matrix.RecaptchaPublicKey == "" {
w.Write([]byte("Homeserver doesn't have a recaptcha public key")) w.Write([]byte("This Homeserver doesn't have a recaptcha public key"))
return nil return nil
} }
@ -142,6 +142,7 @@ func AuthFallback(
} }
} else if req.Method == "POST" { } else if req.Method == "POST" {
clientIP := req.RemoteAddr clientIP := req.RemoteAddr
req.ParseForm()
response := req.Form.Get("g-recaptcha-response") response := req.Form.Get("g-recaptcha-response")
if err := validateRecaptcha(&cfg, response, clientIP); err != nil { if err := validateRecaptcha(&cfg, response, clientIP); err != nil {
ServeRecaptcha() ServeRecaptcha()