diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-30 13:27:07 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-30 13:27:07 +0100 |
commit | ecb4e35f4e6c7304cb274593c13cb47fd5078b75 (patch) | |
tree | 1e238002340bc521afde59d52f406e41298a7aac /client/src/app/shared/users | |
parent | 80d1057bfcd3582af0dacf5ccd5a7a93ef95410b (diff) | |
download | PeerTube-ecb4e35f4e6c7304cb274593c13cb47fd5078b75.tar.gz PeerTube-ecb4e35f4e6c7304cb274593c13cb47fd5078b75.tar.zst PeerTube-ecb4e35f4e6c7304cb274593c13cb47fd5078b75.zip |
Add ability to reset our password
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user.service.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts index 742fb0728..da7b583f4 100644 --- a/client/src/app/shared/users/user.service.ts +++ b/client/src/app/shared/users/user.service.ts | |||
@@ -5,7 +5,6 @@ import 'rxjs/add/operator/map' | |||
5 | import { UserCreate, UserUpdateMe } from '../../../../../shared' | 5 | import { UserCreate, UserUpdateMe } from '../../../../../shared' |
6 | import { environment } from '../../../environments/environment' | 6 | import { environment } from '../../../environments/environment' |
7 | import { RestExtractor } from '../rest' | 7 | import { RestExtractor } from '../rest' |
8 | import { User } from './user.model' | ||
9 | 8 | ||
10 | @Injectable() | 9 | @Injectable() |
11 | export class UserService { | 10 | export class UserService { |
@@ -54,4 +53,24 @@ export class UserService { | |||
54 | return this.authHttp.get(url) | 53 | return this.authHttp.get(url) |
55 | .catch(res => this.restExtractor.handleError(res)) | 54 | .catch(res => this.restExtractor.handleError(res)) |
56 | } | 55 | } |
56 | |||
57 | askResetPassword (email: string) { | ||
58 | const url = UserService.BASE_USERS_URL + '/ask-reset-password' | ||
59 | |||
60 | return this.authHttp.post(url, { email }) | ||
61 | .map(this.restExtractor.extractDataBool) | ||
62 | .catch(res => this.restExtractor.handleError(res)) | ||
63 | } | ||
64 | |||
65 | resetPassword (userId: number, verificationString: string, password: string) { | ||
66 | const url = `${UserService.BASE_USERS_URL}/${userId}/reset-password` | ||
67 | const body = { | ||
68 | verificationString, | ||
69 | password | ||
70 | } | ||
71 | |||
72 | return this.authHttp.post(url, body) | ||
73 | .map(this.restExtractor.extractDataBool) | ||
74 | .catch(res => this.restExtractor.handleError(res)) | ||
75 | } | ||
57 | } | 76 | } |