]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix login error display
authorChocobozzz <me@florianbigard.com>
Tue, 29 Dec 2020 14:23:03 +0000 (15:23 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 29 Dec 2020 14:23:03 +0000 (15:23 +0100)
client/src/app/+login/login.component.ts

index 2567f21f152186d9e34e22ae763f30e8cdc6ce9c..af747b7fa080efc6e1296b56de44b3130ad03324 100644 (file)
@@ -71,6 +71,12 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
   ngOnInit () {
     const snapshot = this.route.snapshot
 
+    // Avoid undefined errors when accessing form error properties
+    this.buildForm({
+      username: LOGIN_USERNAME_VALIDATOR,
+      password: LOGIN_PASSWORD_VALIDATOR
+    })
+
     this.serverConfig = snapshot.data.serverConfig
 
     if (snapshot.queryParams.externalAuthToken) {
@@ -82,11 +88,6 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
       this.externalAuthError = true
       return
     }
-
-    this.buildForm({
-      username: LOGIN_USERNAME_VALIDATOR,
-      password: LOGIN_PASSWORD_VALIDATOR
-    })
   }
 
   ngAfterViewInit () {