Add ability to override login signup message
This commit is contained in:
parent
86ab22921b
commit
f375bb3db4
|
@ -1,9 +1,8 @@
|
||||||
|
import { from, Observable } from 'rxjs'
|
||||||
|
import { mergeMap, switchMap } from 'rxjs/operators'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { PluginService } from '@app/core/plugins/plugin.service'
|
import { PluginService } from '@app/core/plugins/plugin.service'
|
||||||
import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model'
|
import { ClientActionHookName, ClientFilterHookName } from '@shared/models/plugins/client-hook.model'
|
||||||
import { from, Observable } from 'rxjs'
|
|
||||||
import { mergeMap, switchMap } from 'rxjs/operators'
|
|
||||||
import { ServerService } from '@app/core/server'
|
|
||||||
import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
|
import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
|
||||||
|
|
||||||
type RawFunction<U, T> = (params: U) => T
|
type RawFunction<U, T> = (params: U) => T
|
||||||
|
@ -11,10 +10,7 @@ type ObservableFunction<U, T> = RawFunction<U, Observable<T>>
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HooksService {
|
export class HooksService {
|
||||||
constructor (
|
constructor (private pluginService: PluginService) { }
|
||||||
private server: ServerService,
|
|
||||||
private pluginService: PluginService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
wrapObsFun
|
wrapObsFun
|
||||||
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
|
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
|
||||||
|
|
|
@ -47,7 +47,8 @@ export class PluginService implements ClientHook {
|
||||||
common: new ReplaySubject<boolean>(1),
|
common: new ReplaySubject<boolean>(1),
|
||||||
search: new ReplaySubject<boolean>(1),
|
search: new ReplaySubject<boolean>(1),
|
||||||
'video-watch': new ReplaySubject<boolean>(1),
|
'video-watch': new ReplaySubject<boolean>(1),
|
||||||
signup: new ReplaySubject<boolean>(1)
|
signup: new ReplaySubject<boolean>(1),
|
||||||
|
login: new ReplaySubject<boolean>(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
translationsObservable: Observable<PluginTranslation>
|
translationsObservable: Observable<PluginTranslation>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-container *ngIf="!externalAuthError && !isAuthenticatedWithExternalAuth">
|
<ng-container *ngIf="!externalAuthError && !isAuthenticatedWithExternalAuth">
|
||||||
<div class="alert alert-info" *ngIf="signupAllowed === false" role="alert">
|
<div class="looking-for-account alert alert-info" *ngIf="signupAllowed === false" role="alert">
|
||||||
<h6 class="alert-heading" i18n>
|
<h6 class="alert-heading" i18n>
|
||||||
If you are looking for an account…
|
If you are looking for an account…
|
||||||
</h6>
|
</h6>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { ActivatedRoute } from '@angular/router'
|
import { ActivatedRoute } from '@angular/router'
|
||||||
import { ServerConfig, RegisteredExternalAuthConfig } from '@shared/models/server/server-config.model'
|
import { ServerConfig, RegisteredExternalAuthConfig } from '@shared/models/server/server-config.model'
|
||||||
import { environment } from 'src/environments/environment'
|
import { environment } from 'src/environments/environment'
|
||||||
|
import { HooksService } from '@app/core/plugins/hooks.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-login',
|
selector: 'my-login',
|
||||||
|
@ -40,6 +41,7 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private redirectService: RedirectService,
|
private redirectService: RedirectService,
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
|
private hooks: HooksService,
|
||||||
private i18n: I18n
|
private i18n: I18n
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
|
@ -78,6 +80,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
|
||||||
if (this.usernameInput) {
|
if (this.usernameInput) {
|
||||||
this.usernameInput.nativeElement.focus()
|
this.usernameInput.nativeElement.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.hooks.runAction('action:login.init', 'login')
|
||||||
}
|
}
|
||||||
|
|
||||||
getExternalLogins () {
|
getExternalLogins () {
|
||||||
|
|
|
@ -70,6 +70,9 @@ export const clientActionHookObject = {
|
||||||
// Fired when a user click on 'View x replies' and they're loaded
|
// Fired when a user click on 'View x replies' and they're loaded
|
||||||
'action:video-watch.video-thread-replies.loaded': true,
|
'action:video-watch.video-thread-replies.loaded': true,
|
||||||
|
|
||||||
|
// Fired when the login page is being initialized
|
||||||
|
'action:login.init': true,
|
||||||
|
|
||||||
// Fired when the search page is being initialized
|
// Fired when the search page is being initialized
|
||||||
'action:search.init': true,
|
'action:search.init': true,
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup'
|
export type PluginClientScope = 'common' | 'video-watch' | 'search' | 'signup' | 'login'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user