diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-11 14:30:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-11 14:31:12 +0200 |
commit | 0ba5f5baade94a051710d9d9d408ac8083c14ac6 (patch) | |
tree | e470a2b546d1d1ac9796b6c8ae3afffccd0aca6c /client/src/app/shared/users | |
parent | d1ab89deb79f70c439b58750d044d9cadf1194e5 (diff) | |
download | PeerTube-0ba5f5baade94a051710d9d9d408ac8083c14ac6.tar.gz PeerTube-0ba5f5baade94a051710d9d9d408ac8083c14ac6.tar.zst PeerTube-0ba5f5baade94a051710d9d9d408ac8083c14ac6.zip |
Add ability to change email in client
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user.model.ts | 1 | ||||
-rw-r--r-- | client/src/app/shared/users/user.service.ts | 19 |
2 files changed, 18 insertions, 2 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index e3ed2dfbd..14d13959a 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -8,6 +8,7 @@ export class User implements UserServerModel { | |||
8 | id: number | 8 | id: number |
9 | username: string | 9 | username: string |
10 | email: string | 10 | email: string |
11 | pendingEmail: string | null | ||
11 | emailVerified: boolean | 12 | emailVerified: boolean |
12 | nsfwPolicy: NSFWPolicyType | 13 | nsfwPolicy: NSFWPolicyType |
13 | 14 | ||
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts index 70ff9a058..41ee87197 100644 --- a/client/src/app/shared/users/user.service.ts +++ b/client/src/app/shared/users/user.service.ts | |||
@@ -38,6 +38,20 @@ export class UserService { | |||
38 | ) | 38 | ) |
39 | } | 39 | } |
40 | 40 | ||
41 | changeEmail (password: string, newEmail: string) { | ||
42 | const url = UserService.BASE_USERS_URL + 'me' | ||
43 | const body: UserUpdateMe = { | ||
44 | currentPassword: password, | ||
45 | email: newEmail | ||
46 | } | ||
47 | |||
48 | return this.authHttp.put(url, body) | ||
49 | .pipe( | ||
50 | map(this.restExtractor.extractDataBool), | ||
51 | catchError(err => this.restExtractor.handleError(err)) | ||
52 | ) | ||
53 | } | ||
54 | |||
41 | updateMyProfile (profile: UserUpdateMe) { | 55 | updateMyProfile (profile: UserUpdateMe) { |
42 | const url = UserService.BASE_USERS_URL + 'me' | 56 | const url = UserService.BASE_USERS_URL + 'me' |
43 | 57 | ||
@@ -104,10 +118,11 @@ export class UserService { | |||
104 | ) | 118 | ) |
105 | } | 119 | } |
106 | 120 | ||
107 | verifyEmail (userId: number, verificationString: string) { | 121 | verifyEmail (userId: number, verificationString: string, isPendingEmail: boolean) { |
108 | const url = `${UserService.BASE_USERS_URL}/${userId}/verify-email` | 122 | const url = `${UserService.BASE_USERS_URL}/${userId}/verify-email` |
109 | const body = { | 123 | const body = { |
110 | verificationString | 124 | verificationString, |
125 | isPendingEmail | ||
111 | } | 126 | } |
112 | 127 | ||
113 | return this.authHttp.post(url, body) | 128 | return this.authHttp.post(url, body) |