diff options
Diffstat (limited to 'client/src/app/shared')
-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) |