From: Chocobozzz Date: Tue, 28 Apr 2020 12:49:03 +0000 (+0200) Subject: Begin support for external auths X-Git-Tag: v2.2.0-rc.1~110 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4a8d113b9b57d97ff13ad1608798eabca99643e4;p=oweals%2Fpeertube.git Begin support for external auths --- diff --git a/.eslintrc.json b/.eslintrc.json index 9b578b186..e71be9bc5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -83,6 +83,7 @@ "@typescript-eslint/consistent-type-definitions": "off", "@typescript-eslint/no-misused-promises": "off", "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-extraneous-class": "off", // bugged but useful "@typescript-eslint/restrict-plus-operands": "off" diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 9ae008e39..61d755ba0 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -145,7 +145,7 @@ export class AuthService { return !!this.getAccessToken() } - login (username: string, password: string) { + login (username: string, password: string, token?: string) { // Form url encoded const body = { client_id: this.clientId, @@ -157,6 +157,8 @@ export class AuthService { password } + if (token) Object.assign(body, { externalAuthToken: token }) + const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') return this.http.post(AuthService.BASE_TOKEN_URL, objectToUrlEncoded(body), { headers }) .pipe( diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index da7832b32..eac8f85e4 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -54,7 +54,9 @@ export class ServerService { } }, plugin: { - registered: [] + registered: [], + registeredExternalAuths: [], + registeredIdAndPassAuths: [] }, theme: { registered: [], diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html index 3a2d4b876..3e53e5854 100644 --- a/client/src/app/login/login.component.html +++ b/client/src/app/login/login.component.html @@ -3,59 +3,61 @@ Login -