diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RegisterPage.js b/monkey/monkey_island/cc/ui/src/components/pages/RegisterPage.js
index 093dba950..2ebd9baf5 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/RegisterPage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/RegisterPage.js
@@ -39,11 +39,12 @@ class RegisterPageComponent extends React.Component {
           this.auth.attemptNoAuthLogin().then(() => {
             this.redirectToHome();
           });
+        } else {
+          this.setState({
+            failed: true,
+            error: res['error']
+          });
         }
-        this.setState({
-          failed: true,
-          error: res['error']
-        });
       })
   }