From 62024ae051ae2dbde7fc087aa3bda3e6a91bc509 Mon Sep 17 00:00:00 2001
From: Ilija Lazoroski <ilija.la@live.com>
Date: Thu, 29 Jul 2021 17:18:53 +0200
Subject: [PATCH] UI: Fix brief red alert on register.

---
 .../cc/ui/src/components/pages/RegisterPage.js           | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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']
-        });
       })
   }