diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-13 11:05:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 41d1d075011174e73dccb74006181a92a618d7b4 (patch) | |
tree | 4dc1af0e266977f062cf9716837d04de1cdd628d /shared/extra-utils/users/users.ts | |
parent | 6c5065a011b099618681a37bd77eaa7bd3db752e (diff) | |
download | PeerTube-41d1d075011174e73dccb74006181a92a618d7b4.tar.gz PeerTube-41d1d075011174e73dccb74006181a92a618d7b4.tar.zst PeerTube-41d1d075011174e73dccb74006181a92a618d7b4.zip |
Introduce login command
Diffstat (limited to 'shared/extra-utils/users/users.ts')
-rw-r--r-- | shared/extra-utils/users/users.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts index 0f15962ad..835ad08ba 100644 --- a/shared/extra-utils/users/users.ts +++ b/shared/extra-utils/users/users.ts | |||
@@ -7,7 +7,6 @@ import { UserRegister } from '../../models/users/user-register.model' | |||
7 | import { UserRole } from '../../models/users/user-role' | 7 | import { UserRole } from '../../models/users/user-role' |
8 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest, updateImageRequest } from '../requests/requests' | 8 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest, updateImageRequest } from '../requests/requests' |
9 | import { ServerInfo } from '../server/servers' | 9 | import { ServerInfo } from '../server/servers' |
10 | import { userLogin } from './login' | ||
11 | 10 | ||
12 | function createUser (parameters: { | 11 | function createUser (parameters: { |
13 | url: string | 12 | url: string |
@@ -55,7 +54,7 @@ async function generateUser (server: ServerInfo, username: string) { | |||
55 | const password = 'my super password' | 54 | const password = 'my super password' |
56 | const resCreate = await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) | 55 | const resCreate = await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) |
57 | 56 | ||
58 | const token = await userLogin(server, { username, password }) | 57 | const token = await server.loginCommand.getAccessToken({ username, password }) |
59 | 58 | ||
60 | const resMe = await getMyUserInformation(server.url, token) | 59 | const resMe = await getMyUserInformation(server.url, token) |
61 | 60 | ||
@@ -70,7 +69,7 @@ async function generateUserAccessToken (server: ServerInfo, username: string) { | |||
70 | const password = 'my super password' | 69 | const password = 'my super password' |
71 | await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) | 70 | await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) |
72 | 71 | ||
73 | return userLogin(server, { username, password }) | 72 | return server.loginCommand.getAccessToken({ username, password }) |
74 | } | 73 | } |
75 | 74 | ||
76 | function registerUser (url: string, username: string, password: string, specialStatus = HttpStatusCode.NO_CONTENT_204) { | 75 | function registerUser (url: string, username: string, password: string, specialStatus = HttpStatusCode.NO_CONTENT_204) { |