summary refs log tree commit diff
path: root/webclient/login
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/login')
-rw-r--r--webclient/login/register-controller.js9
1 files changed, 9 insertions, 0 deletions
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.";