diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 09:30:29 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 10:37:27 +0100 |
commit | b426edd4854adc6e65844d8c54b8998e792b5778 (patch) | |
tree | b9ef4da0cdb2ab14c0aa1d67a883303f3ed0de14 /shared | |
parent | 67b1d3fed765278bdc876cce393ef56d56942df0 (diff) | |
download | PeerTube-b426edd4854adc6e65844d8c54b8998e792b5778.tar.gz PeerTube-b426edd4854adc6e65844d8c54b8998e792b5778.tar.zst PeerTube-b426edd4854adc6e65844d8c54b8998e792b5778.zip |
Cleanup reset user password by admin
And add some tests
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/users/user-update.model.ts | 1 | ||||
-rw-r--r-- | shared/utils/users/users.ts | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/shared/models/users/user-update.model.ts b/shared/models/users/user-update.model.ts index abde51321..cd215bab3 100644 --- a/shared/models/users/user-update.model.ts +++ b/shared/models/users/user-update.model.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { UserRole } from './user-role' | 1 | import { UserRole } from './user-role' |
2 | 2 | ||
3 | export interface UserUpdate { | 3 | export interface UserUpdate { |
4 | password?: string | ||
4 | email?: string | 5 | email?: string |
5 | emailVerified?: boolean | 6 | emailVerified?: boolean |
6 | videoQuota?: number | 7 | videoQuota?: number |
diff --git a/shared/utils/users/users.ts b/shared/utils/users/users.ts index 61a7e3757..7191b263e 100644 --- a/shared/utils/users/users.ts +++ b/shared/utils/users/users.ts | |||
@@ -213,11 +213,13 @@ function updateUser (options: { | |||
213 | emailVerified?: boolean, | 213 | emailVerified?: boolean, |
214 | videoQuota?: number, | 214 | videoQuota?: number, |
215 | videoQuotaDaily?: number, | 215 | videoQuotaDaily?: number, |
216 | password?: string, | ||
216 | role?: UserRole | 217 | role?: UserRole |
217 | }) { | 218 | }) { |
218 | const path = '/api/v1/users/' + options.userId | 219 | const path = '/api/v1/users/' + options.userId |
219 | 220 | ||
220 | const toSend = {} | 221 | const toSend = {} |
222 | if (options.password !== undefined && options.password !== null) toSend['password'] = options.password | ||
221 | if (options.email !== undefined && options.email !== null) toSend['email'] = options.email | 223 | if (options.email !== undefined && options.email !== null) toSend['email'] = options.email |
222 | if (options.emailVerified !== undefined && options.emailVerified !== null) toSend['emailVerified'] = options.emailVerified | 224 | if (options.emailVerified !== undefined && options.emailVerified !== null) toSend['emailVerified'] = options.emailVerified |
223 | if (options.videoQuota !== undefined && options.videoQuota !== null) toSend['videoQuota'] = options.videoQuota | 225 | if (options.videoQuota !== undefined && options.videoQuota !== null) toSend['videoQuota'] = options.videoQuota |