diff options
Diffstat (limited to 'shared/utils/users/users.ts')
-rw-r--r-- | shared/utils/users/users.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/utils/users/users.ts b/shared/utils/users/users.ts index 7191b263e..e3c14a4a3 100644 --- a/shared/utils/users/users.ts +++ b/shared/utils/users/users.ts | |||
@@ -3,6 +3,7 @@ import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '.. | |||
3 | 3 | ||
4 | import { UserRole } from '../../index' | 4 | import { UserRole } from '../../index' |
5 | import { NSFWPolicyType } from '../../models/videos/nsfw-policy.type' | 5 | import { NSFWPolicyType } from '../../models/videos/nsfw-policy.type' |
6 | import { ServerInfo, userLogin } from '..' | ||
6 | 7 | ||
7 | function createUser ( | 8 | function createUser ( |
8 | url: string, | 9 | url: string, |
@@ -32,6 +33,13 @@ function createUser ( | |||
32 | .expect(specialStatus) | 33 | .expect(specialStatus) |
33 | } | 34 | } |
34 | 35 | ||
36 | async function generateUserAccessToken (server: ServerInfo, username: string) { | ||
37 | const password = 'my super password' | ||
38 | await createUser(server.url, server.accessToken, username, password) | ||
39 | |||
40 | return userLogin(server, { username, password }) | ||
41 | } | ||
42 | |||
35 | function registerUser (url: string, username: string, password: string, specialStatus = 204) { | 43 | function registerUser (url: string, username: string, password: string, specialStatus = 204) { |
36 | const path = '/api/v1/users/register' | 44 | const path = '/api/v1/users/register' |
37 | const body = { | 45 | const body = { |
@@ -300,5 +308,6 @@ export { | |||
300 | resetPassword, | 308 | resetPassword, |
301 | updateMyAvatar, | 309 | updateMyAvatar, |
302 | askSendVerifyEmail, | 310 | askSendVerifyEmail, |
311 | generateUserAccessToken, | ||
303 | verifyEmail | 312 | verifyEmail |
304 | } | 313 | } |