From ba7b7e572f0634e534320a057f4cc0a95f2a541d Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 25 Nov 2019 11:16:12 +0100 Subject: (plugins) adding signup scope and init hook, modifying ensureUserRegistrationAllowed allowedParams --- client/src/app/+signup/+register/register.component.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'client/src/app/+signup/+register/register.component.ts') diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts index d470ef4dc..5a7215516 100644 --- a/client/src/app/+signup/+register/register.component.ts +++ b/client/src/app/+signup/+register/register.component.ts @@ -6,6 +6,7 @@ import { UserRegister } from '@shared/models/users/user-register.model' import { FormGroup } from '@angular/forms' import { About } 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' @Component({ @@ -41,6 +42,7 @@ export class RegisterComponent implements OnInit { private serverService: ServerService, private redirectService: RedirectService, private instanceService: InstanceService, + private hooks: HooksService, private i18n: I18n ) { } @@ -60,6 +62,8 @@ export class RegisterComponent implements OnInit { err => this.notifier.error(err.message) ) + + this.hooks.runAction('action:signup.register.init', 'signup') } hasSameChannelAndAccountNames () { @@ -94,10 +98,13 @@ 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 }), + 'filter:api.signup.registration.create.params' + ) this.userService.signup(body).subscribe( () => { -- cgit v1.2.3