+ checkPassword () {
+ this.error = null
+ const oldPassword = this.form.value[ 'old-password' ];
+
+ // compare old password
+ this.authService.login(this.user.account.name, oldPassword)
+ .subscribe(
+ () => this.changePassword(),
+ err => {
+ if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect old password.')
+ else this.error = err.message
+ }
+ )
+
+ }
+
+ private changePassword(){