]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+signup/+register/register.component.ts
Improve advanced input filter
[github/Chocobozzz/PeerTube.git] / client / src / app / +signup / +register / register.component.ts
index 056442107c8a706dea3cc979263259f68cf6f1da..bb727645902a0cf8cab267fe602693e8798b4bee 100644 (file)
@@ -42,6 +42,8 @@ export class RegisterComponent implements OnInit {
   defaultNextStepButtonLabel = $localize`:Button on the registration form to go to the previous step:Next`
   stepUserButtonLabel = this.defaultNextStepButtonLabel
 
+  signupDisabled = false
+
   private serverConfig: ServerConfig
 
   constructor (
@@ -49,8 +51,7 @@ export class RegisterComponent implements OnInit {
     private authService: AuthService,
     private userService: UserService,
     private hooks: HooksService
-    ) {
-  }
+  ) { }
 
   get requiresEmailVerification () {
     return this.serverConfig.signup.requiresEmailVerification
@@ -63,6 +64,11 @@ export class RegisterComponent implements OnInit {
   ngOnInit (): void {
     this.serverConfig = this.route.snapshot.data.serverConfig
 
+    if (this.serverConfig.signup.allowed === false || this.serverConfig.signup.allowedForCurrentIP === false) {
+      this.signupDisabled = true
+      return
+    }
+
     this.videoUploadDisabled = this.serverConfig.user.videoQuota === 0
     this.stepUserButtonLabel = this.videoUploadDisabled
       ? $localize`:Button on the registration form to finalize the account and channel creation:Signup`
@@ -138,11 +144,15 @@ export class RegisterComponent implements OnInit {
               this.success = $localize`You are now logged in as ${body.username}!`
             },
 
-            error: err => this.error = err.message
+            error: err => {
+              this.error = err.message
+            }
           })
       },
 
-      error: err => this.error = err.message
+      error: err => {
+        this.error = err.message
+      }
     })
   }
 }