From 4a8d113b9b57d97ff13ad1608798eabca99643e4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Apr 2020 14:49:03 +0200 Subject: Begin support for external auths --- client/src/app/core/auth/auth.service.ts | 4 +- client/src/app/core/server/server.service.ts | 4 +- client/src/app/login/login.component.html | 88 ++++++++++++++-------------- client/src/app/login/login.component.ts | 36 ++++++++++-- 4 files changed, 81 insertions(+), 51 deletions(-) (limited to 'client/src/app') 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 -