aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-30 13:27:07 +0100
committerChocobozzz <me@florianbigard.com>2018-01-30 13:27:07 +0100
commitecb4e35f4e6c7304cb274593c13cb47fd5078b75 (patch)
tree1e238002340bc521afde59d52f406e41298a7aac /client/src/app/shared/users
parent80d1057bfcd3582af0dacf5ccd5a7a93ef95410b (diff)
downloadPeerTube-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.ts21
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'
5import { UserCreate, UserUpdateMe } from '../../../../../shared' 5import { UserCreate, UserUpdateMe } from '../../../../../shared'
6import { environment } from '../../../environments/environment' 6import { environment } from '../../../environments/environment'
7import { RestExtractor } from '../rest' 7import { RestExtractor } from '../rest'
8import { User } from './user.model'
9 8
10@Injectable() 9@Injectable()
11export class UserService { 10export 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}