aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users/login-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 14:23:01 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (patch)
tree7a166515e4d57a06eb3c08be569f106ed049988b /shared/extra-utils/users/login-command.ts
parentd0a0fa429d4651710ed951a3c11af0219e408964 (diff)
downloadPeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip
Introduce user command
Diffstat (limited to 'shared/extra-utils/users/login-command.ts')
-rw-r--r--shared/extra-utils/users/login-command.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts
index 8af3531f9..b4e3bb602 100644
--- a/shared/extra-utils/users/login-command.ts
+++ b/shared/extra-utils/users/login-command.ts
@@ -7,7 +7,7 @@ export class LoginCommand extends AbstractCommand {
7 7
8 login (options: OverrideCommandOptions & { 8 login (options: OverrideCommandOptions & {
9 client?: { id?: string, secret?: string } 9 client?: { id?: string, secret?: string }
10 user?: { username: string, password: string } 10 user?: { username: string, password?: string }
11 } = {}) { 11 } = {}) {
12 const { client = this.server.client, user = this.server.user } = options 12 const { client = this.server.client, user = this.server.user } = options
13 const path = '/api/v1/users/token' 13 const path = '/api/v1/users/token'
@@ -16,7 +16,7 @@ export class LoginCommand extends AbstractCommand {
16 client_id: client.id, 16 client_id: client.id,
17 client_secret: client.secret, 17 client_secret: client.secret,
18 username: user.username, 18 username: user.username,
19 password: user.password, 19 password: user.password ?? 'password',
20 response_type: 'code', 20 response_type: 'code',
21 grant_type: 'password', 21 grant_type: 'password',
22 scope: 'upload' 22 scope: 'upload'
@@ -33,10 +33,10 @@ export class LoginCommand extends AbstractCommand {
33 })) 33 }))
34 } 34 }
35 35
36 getAccessToken (arg1?: { username: string, password: string }): Promise<string> 36 getAccessToken (arg1?: { username: string, password?: string }): Promise<string>
37 getAccessToken (arg1: string, password: string): Promise<string> 37 getAccessToken (arg1: string, password?: string): Promise<string>
38 async getAccessToken (arg1?: { username: string, password: string } | string, password?: string) { 38 async getAccessToken (arg1?: { username: string, password?: string } | string, password?: string) {
39 let user: { username: string, password: string } 39 let user: { username: string, password?: string }
40 40
41 if (!arg1) user = this.server.user 41 if (!arg1) user = this.server.user
42 else if (typeof arg1 === 'object') user = arg1 42 else if (typeof arg1 === 'object') user = arg1