X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bsignup%2F%2Bregister%2Fregister.component.ts;h=ae944ec15b57594f4ca605a7e06b3ce6c9414d6c;hb=1d17d86349fd2b3a9bc85145d02383ba4aea4dc0;hp=d470ef4dcc1830f5f1e1f9ea4bc37f34ee5ffb9a;hpb=8d5e65349deebd499c0be10fe02d535a77d58ddb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts index d470ef4dc..ae944ec15 100644 --- a/client/src/app/+signup/+register/register.component.ts +++ b/client/src/app/+signup/+register/register.component.ts @@ -4,9 +4,11 @@ import { UserService, UserValidatorsService } from '@app/shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { UserRegister } from '@shared/models/users/user-register.model' import { FormGroup } from '@angular/forms' -import { About } from '@shared/models/server' +import { About, ServerConfig } from '@shared/models/server' import { InstanceService } from '@app/shared/instance/instance.service' +import { HooksService } from '@app/core/plugins/hooks.service' import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' +import { ActivatedRoute } from '@angular/router' @Component({ selector: 'my-register', @@ -33,7 +35,10 @@ export class RegisterComponent implements OnInit { formStepUser: FormGroup formStepChannel: FormGroup + private serverConfig: ServerConfig + constructor ( + private route: ActivatedRoute, private authService: AuthService, private userValidatorsService: UserValidatorsService, private notifier: Notifier, @@ -41,15 +46,18 @@ export class RegisterComponent implements OnInit { private serverService: ServerService, private redirectService: RedirectService, private instanceService: InstanceService, + private hooks: HooksService, private i18n: I18n ) { } get requiresEmailVerification () { - return this.serverService.getConfig().signup.requiresEmailVerification + return this.serverConfig.signup.requiresEmailVerification } ngOnInit (): void { + this.serverConfig = this.route.snapshot.data.serverConfig + this.instanceService.getAbout() .subscribe( async about => { @@ -60,6 +68,8 @@ export class RegisterComponent implements OnInit { err => this.notifier.error(err.message) ) + + this.hooks.runAction('action:signup.register.init', 'signup') } hasSameChannelAndAccountNames () { @@ -94,10 +104,14 @@ export class RegisterComponent implements OnInit { if (this.accordion) this.accordion.toggle('code-of-conduct') } - signup () { + async signup () { this.error = null - const body: UserRegister = Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }) + const body: UserRegister = await this.hooks.wrapObject( + Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }), + 'signup', + 'filter:api.signup.registration.create.params' + ) this.userService.signup(body).subscribe( () => {