X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Blogin%2Flogin.component.ts;h=1fa4bd3b5f4092b08e6ad106b5a7e9d937ec8a82;hb=8406a9e8eec261e563d99c92f8a18b6bd3e46e0f;hp=d8ad49081caec79b8fc99db4648a4ab1611b695b;hpb=e62f03ae0412f4efa62917d8741bc1a39e8ed7fc;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.ts index d8ad49081..1fa4bd3b5 100644 --- a/client/src/app/+login/login.component.ts +++ b/client/src/app/+login/login.component.ts @@ -46,7 +46,7 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni private redirectService: RedirectService, private notifier: Notifier, private hooks: HooksService - ) { + ) { super() } @@ -107,17 +107,17 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni const { username, password } = this.form.value this.authService.login(username, password) - .subscribe( - () => this.redirectService.redirectToPreviousRoute(), + .subscribe({ + next: () => this.redirectService.redirectToPreviousRoute(), - err => this.handleError(err) - ) + error: err => this.handleError(err) + }) } askResetPassword () { this.userService.askResetPassword(this.forgotPasswordEmail) - .subscribe( - () => { + .subscribe({ + next: () => { const message = $localize`An email with the reset password instructions will be sent to ${this.forgotPasswordEmail}. The link will expire within 1 hour.` @@ -125,8 +125,8 @@ The link will expire within 1 hour.` this.hideForgotPasswordModal() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } openForgotPasswordModal () { @@ -141,18 +141,22 @@ The link will expire within 1 hour.` this.accordion = instanceAboutAccordion.accordion } + hasUsernameUppercase () { + return this.form.value['username'].match(/[A-Z]/) + } + private loadExternalAuthToken (username: string, token: string) { this.isAuthenticatedWithExternalAuth = true this.authService.login(username, null, token) - .subscribe( - () => this.redirectService.redirectToPreviousRoute(), - - err => { - this.handleError(err) - this.isAuthenticatedWithExternalAuth = false - } - ) + .subscribe({ + next: () => this.redirectService.redirectToPreviousRoute(), + + error: err => { + this.handleError(err) + this.isAuthenticatedWithExternalAuth = false + } + }) } private handleError (err: any) {