aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-settings/my-account-change-password
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-04 16:21:17 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 08:43:01 +0200
commitb1d40cff89f7cff565a98cdbcea9a624196a169a (patch)
treed24746c1cc69f50471a9eba0dfb1c1bae06a1870 /client/src/app/+my-account/my-account-settings/my-account-change-password
parent989e526abf0c0dd7958deb630df009608561bb67 (diff)
downloadPeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip
Add i18n attributes
Diffstat (limited to 'client/src/app/+my-account/my-account-settings/my-account-change-password')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html8
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts8
2 files changed, 9 insertions, 7 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html
index b0e3cada4..767ef0336 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html
@@ -2,9 +2,9 @@
2 2
3<form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> 3<form role="form" (ngSubmit)="changePassword()" [formGroup]="form">
4 4
5 <label for="new-password">Change password</label> 5 <label i18n for="new-password">Change password</label>
6 <input 6 <input
7 type="password" id="new-password" placeholder="New password" 7 type="password" id="new-password" i18n-placeholder placeholder="New password"
8 formControlName="new-password" [ngClass]="{ 'input-error': formErrors['new-password'] }" 8 formControlName="new-password" [ngClass]="{ 'input-error': formErrors['new-password'] }"
9 > 9 >
10 <div *ngIf="formErrors['new-password']" class="form-error"> 10 <div *ngIf="formErrors['new-password']" class="form-error">
@@ -12,9 +12,9 @@
12 </div> 12 </div>
13 13
14 <input 14 <input
15 type="password" id="new-confirmed-password" placeholder="Confirm new password" 15 type="password" id="new-confirmed-password" i18n-placeholder placeholder="Confirm new password"
16 formControlName="new-confirmed-password" 16 formControlName="new-confirmed-password"
17 > 17 >
18 18
19 <input type="submit" value="Change password" [disabled]="!form.valid"> 19 <input type="submit" i18n-value value="Change password" [disabled]="!form.valid">
20</form> 20</form>
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
index 80af668f9..1a88aa82e 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' 4import { FormReactive, USER_PASSWORD, UserService } from '../../../shared'
5import { I18n } from '@ngx-translate/i18n-polyfill'
5 6
6@Component({ 7@Component({
7 selector: 'my-account-change-password', 8 selector: 'my-account-change-password',
@@ -24,7 +25,8 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On
24 constructor ( 25 constructor (
25 private formBuilder: FormBuilder, 26 private formBuilder: FormBuilder,
26 private notificationsService: NotificationsService, 27 private notificationsService: NotificationsService,
27 private userService: UserService 28 private userService: UserService,
29 private i18n: I18n
28 ) { 30 ) {
29 super() 31 super()
30 } 32 }
@@ -49,12 +51,12 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On
49 this.error = null 51 this.error = null
50 52
51 if (newPassword !== newConfirmedPassword) { 53 if (newPassword !== newConfirmedPassword) {
52 this.error = 'The new password and the confirmed password do not correspond.' 54 this.error = this.i18n('The new password and the confirmed password do not correspond.')
53 return 55 return
54 } 56 }
55 57
56 this.userService.changePassword(newPassword).subscribe( 58 this.userService.changePassword(newPassword).subscribe(
57 () => this.notificationsService.success('Success', 'Password updated.'), 59 () => this.notificationsService.success(this.i18n('Success'), this.i18n('Password updated.')),
58 60
59 err => this.error = err.message 61 err => this.error = err.message
60 ) 62 )