aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <chocobozzz@framasoft.org>2019-11-25 11:16:12 +0100
committerChocobozzz <chocobozzz@framasoft.org>2019-11-25 11:16:12 +0100
commitf92bb405d48af737636fec1025e19f27d7044158 (patch)
tree687759585d7c92f865112ca3e920764471603b20 /client/src
parentefcd6f2e625c1c5d06025f27a2bf3a84d3f8b483 (diff)
parentba7b7e572f0634e534320a057f4cc0a95f2a541d (diff)
downloadPeerTube-f92bb405d48af737636fec1025e19f27d7044158.tar.gz
PeerTube-f92bb405d48af737636fec1025e19f27d7044158.tar.zst
PeerTube-f92bb405d48af737636fec1025e19f27d7044158.zip
Merge branch 'signup-hooks' into 'develop'
(plugins) adding signup scope and init hook, modifying ensureUserRegistrationAllowed allowedParams See merge request framasoft/peertube/PeerTube!24
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+signup/+register/register.component.ts11
-rw-r--r--client/src/app/core/plugins/plugin.service.ts3
2 files changed, 11 insertions, 3 deletions
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'
6import { FormGroup } from '@angular/forms' 6import { FormGroup } from '@angular/forms'
7import { About } from '@shared/models/server' 7import { About } from '@shared/models/server'
8import { InstanceService } from '@app/shared/instance/instance.service' 8import { InstanceService } from '@app/shared/instance/instance.service'
9import { HooksService } from '@app/core/plugins/hooks.service'
9import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' 10import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap'
10 11
11@Component({ 12@Component({
@@ -41,6 +42,7 @@ export class RegisterComponent implements OnInit {
41 private serverService: ServerService, 42 private serverService: ServerService,
42 private redirectService: RedirectService, 43 private redirectService: RedirectService,
43 private instanceService: InstanceService, 44 private instanceService: InstanceService,
45 private hooks: HooksService,
44 private i18n: I18n 46 private i18n: I18n
45 ) { 47 ) {
46 } 48 }
@@ -60,6 +62,8 @@ export class RegisterComponent implements OnInit {
60 62
61 err => this.notifier.error(err.message) 63 err => this.notifier.error(err.message)
62 ) 64 )
65
66 this.hooks.runAction('action:signup.register.init', 'signup')
63 } 67 }
64 68
65 hasSameChannelAndAccountNames () { 69 hasSameChannelAndAccountNames () {
@@ -94,10 +98,13 @@ export class RegisterComponent implements OnInit {
94 if (this.accordion) this.accordion.toggle('code-of-conduct') 98 if (this.accordion) this.accordion.toggle('code-of-conduct')
95 } 99 }
96 100
97 signup () { 101 async signup () {
98 this.error = null 102 this.error = null
99 103
100 const body: UserRegister = Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }) 104 const body: UserRegister = await this.hooks.wrapObject(
105 Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }),
106 'filter:api.signup.registration.create.params'
107 )
101 108
102 this.userService.signup(body).subscribe( 109 this.userService.signup(body).subscribe(
103 () => { 110 () => {
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 3af36765a..52ba4215a 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -42,7 +42,8 @@ export class PluginService implements ClientHook {
42 pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject<boolean> } = { 42 pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject<boolean> } = {
43 common: new ReplaySubject<boolean>(1), 43 common: new ReplaySubject<boolean>(1),
44 search: new ReplaySubject<boolean>(1), 44 search: new ReplaySubject<boolean>(1),
45 'video-watch': new ReplaySubject<boolean>(1) 45 'video-watch': new ReplaySubject<boolean>(1),
46 signup: new ReplaySubject<boolean>(1)
46 } 47 }
47 48
48 translationsObservable: Observable<PluginTranslation> 49 translationsObservable: Observable<PluginTranslation>