defaultNextStepButtonLabel = $localize`:Button on the registration form to go to the previous step:Next`
stepUserButtonLabel = this.defaultNextStepButtonLabel
+ signupDisabled = false
+
private serverConfig: ServerConfig
constructor (
private authService: AuthService,
private userService: UserService,
private hooks: HooksService
- ) {
- }
+ ) { }
get requiresEmailVerification () {
return this.serverConfig.signup.requiresEmailVerification
}
+ get minimumAge () {
+ return this.serverConfig.signup.minimumAge
+ }
+
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`
'filter:api.signup.registration.create.params'
)
- this.userService.signup(body).subscribe(
- () => {
+ this.userService.signup(body).subscribe({
+ next: () => {
this.signupDone = true
if (this.requiresEmailVerification) {
// Auto login
this.authService.login(body.username, body.password)
- .subscribe(
- () => {
- this.success = $localize`You are now logged in as ${body.username}!`
- },
-
- err => this.error = err.message
- )
+ .subscribe({
+ next: () => {
+ this.success = $localize`You are now logged in as ${body.username}!`
+ },
+
+ error: err => {
+ this.error = err.message
+ }
+ })
},
- err => this.error = err.message
- )
+ error: err => {
+ this.error = err.message
+ }
+ })
}
}