aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 11:05:15 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit41d1d075011174e73dccb74006181a92a618d7b4 (patch)
tree4dc1af0e266977f062cf9716837d04de1cdd628d /shared/extra-utils/users/users.ts
parent6c5065a011b099618681a37bd77eaa7bd3db752e (diff)
downloadPeerTube-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.ts5
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'
7import { UserRole } from '../../models/users/user-role' 7import { UserRole } from '../../models/users/user-role'
8import { makeGetRequest, makePostBodyRequest, makePutBodyRequest, updateImageRequest } from '../requests/requests' 8import { makeGetRequest, makePostBodyRequest, makePutBodyRequest, updateImageRequest } from '../requests/requests'
9import { ServerInfo } from '../server/servers' 9import { ServerInfo } from '../server/servers'
10import { userLogin } from './login'
11 10
12function createUser (parameters: { 11function 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
76function registerUser (url: string, username: string, password: string, specialStatus = HttpStatusCode.NO_CONTENT_204) { 75function registerUser (url: string, username: string, password: string, specialStatus = HttpStatusCode.NO_CONTENT_204) {