aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-edit/user-update.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/users/user-edit/user-update.component.ts')
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts24
1 files changed, 23 insertions, 1 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts
index 61e641823..cb74897d0 100644
--- a/client/src/app/+admin/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-update.component.ts
@@ -1,4 +1,4 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit, Input } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { Subscription } from 'rxjs' 3import { Subscription } from 'rxjs'
4import { Notifier } from '@app/core' 4import { Notifier } from '@app/core'
@@ -19,9 +19,12 @@ import { UserService } from '@app/shared'
19export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { 19export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
20 error: string 20 error: string
21 userId: number 21 userId: number
22 userEmail: string
22 username: string 23 username: string
24 isAdministration = false
23 25
24 private paramsSub: Subscription 26 private paramsSub: Subscription
27 private isAdministrationSub: Subscription
25 28
26 constructor ( 29 constructor (
27 protected formValidatorService: FormValidatorService, 30 protected formValidatorService: FormValidatorService,
@@ -56,10 +59,15 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
56 err => this.error = err.message 59 err => this.error = err.message
57 ) 60 )
58 }) 61 })
62
63 this.isAdministrationSub = this.route.data.subscribe(data => {
64 if (data.isAdministration) this.isAdministration = data.isAdministration
65 })
59 } 66 }
60 67
61 ngOnDestroy () { 68 ngOnDestroy () {
62 this.paramsSub.unsubscribe() 69 this.paramsSub.unsubscribe()
70 this.isAdministrationSub.unsubscribe()
63 } 71 }
64 72
65 formValidated () { 73 formValidated () {
@@ -89,9 +97,23 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
89 return this.i18n('Update user') 97 return this.i18n('Update user')
90 } 98 }
91 99
100 resetPassword () {
101 this.userService.askResetPassword(this.userEmail).subscribe(
102 () => {
103 this.notificationsService.success(
104 this.i18n('Success'),
105 this.i18n('An email asking for password reset has been sent to {{username}}.', { username: this.username })
106 )
107 },
108
109 err => this.error = err.message
110 )
111 }
112
92 private onUserFetched (userJson: User) { 113 private onUserFetched (userJson: User) {
93 this.userId = userJson.id 114 this.userId = userJson.id
94 this.username = userJson.username 115 this.username = userJson.username
116 this.userEmail = userJson.email
95 117
96 this.form.patchValue({ 118 this.form.patchValue({
97 email: userJson.email, 119 email: userJson.email,