From cf957f21d4b2e14e428a598390d3d9fee136f954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 20 Jan 2021 23:36:34 +0100 Subject: Automatically submit login form as invite user --- client/src/app/+login/login.component.ts | 5 +++++ client/src/app/core/auth/auth.service.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.ts index af747b7fa..d52ad1195 100644 --- a/client/src/app/+login/login.component.ts +++ b/client/src/app/+login/login.component.ts @@ -77,6 +77,11 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni password: LOGIN_PASSWORD_VALIDATOR }) + if (!this.authService.isLoggedIn()) { + this.form.controls.username.setValue("invite") + this.form.controls.password.setValue("invite") + this.login() + } this.serverConfig = snapshot.data.serverConfig if (snapshot.queryParams.externalAuthToken) { diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index cdf13186b..7acfabfe8 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -142,6 +142,7 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular login (username: string, password: string, token?: string) { // Form url encoded + if (this.isLoggedIn()) this.logout() const body = { client_id: this.clientId, client_secret: this.clientSecret, -- cgit v1.2.3