summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/handlers/register.py4
-rw-r--r--webclient/login/register-controller.js9
2 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 0693112ba8..0b841d6d3a 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -62,8 +62,8 @@ class RegistrationHandler(BaseHandler):
                 captcha_info["response"]
             )
             if not captcha_response["valid"]:
-                logger.info("Invalid captcha entered from %s", 
-                            captcha_info["ip"])
+                logger.info("Invalid captcha entered from %s. Error: %s", 
+                            captcha_info["ip"], captcha_response["error_url"])
                 raise InvalidCaptchaError(
                     error_url=captcha_response["error_url"]
                 )
diff --git a/webclient/login/register-controller.js b/webclient/login/register-controller.js
index 96fffb364d..1ab50888df 100644
--- a/webclient/login/register-controller.js
+++ b/webclient/login/register-controller.js
@@ -92,6 +92,9 @@ angular.module('RegisterController', ['matrixService'])
         matrixService.register(mxid, password, threepidCreds, useCaptcha).then(
             function(response) {
                 $scope.feedback = "Success";
+                if (useCaptcha) {
+                    Recaptcha.destroy();
+                }
                 // Update the current config 
                 var config = matrixService.config();
                 angular.extend(config, {
@@ -118,11 +121,17 @@ angular.module('RegisterController', ['matrixService'])
             },
             function(error) {
                 console.trace("Registration error: "+error);
+                if (useCaptcha) {
+                    Recaptcha.reload();
+                }
                 if (error.data) {
                     if (error.data.errcode === "M_USER_IN_USE") {
                         $scope.feedback = "Username already taken.";
                         $scope.reenter_username = true;
                     }
+                    else if (error.data.errcode == "M_CAPTCHA_INVALID") {
+                        $scope.feedback = "Failed captcha.";
+                    }
                 }
                 else if (error.status === 0) {
                     $scope.feedback = "Unable to talk to the server.";