diff --git a/src/ui_ng/src/app/user/change-password/change-password.component.ts b/src/ui_ng/src/app/user/change-password/change-password.component.ts index a961f3ba2..4d41f86b3 100644 --- a/src/ui_ng/src/app/user/change-password/change-password.component.ts +++ b/src/ui_ng/src/app/user/change-password/change-password.component.ts @@ -17,6 +17,7 @@ import { NgForm } from '@angular/forms'; import { InlineAlertComponent } from '../../shared/inline-alert/inline-alert.component'; import { MessageHandlerService } from '../../shared/message-handler/message-handler.service'; import {UserService} from "../user.service"; +import {TranslateService} from "@ngx-translate/core"; @Component({ selector: 'change-password', @@ -41,6 +42,7 @@ export class ChangePasswordComponent { constructor( private userService: UserService, private msgHandler: MessageHandlerService, + private translateService: TranslateService, private ref: ChangeDetectorRef) { } public get showProgress(): boolean { @@ -106,12 +108,14 @@ export class ChangePasswordComponent { }) .catch(error => { this.onGoing = false; - if (this.msgHandler.isAppLevel(error)) { - this.msgHandler.handleError(error); - this.opened = false; - } else { + if (error.status === 400) { + this.translateService.get("USER.EXISTING_PASSWORD").subscribe( + res => {this.inlineAlert.showInlineError(res); }); + }else { this.inlineAlert.showInlineError(error); } + let hnd = setInterval(() => this.ref.markForCheck(), 100); + setTimeout(() => clearInterval(hnd), 2000); }); } diff --git a/src/ui_ng/src/i18n/lang/en-us-lang.json b/src/ui_ng/src/i18n/lang/en-us-lang.json index e5ab02b83..fe680f68a 100644 --- a/src/ui_ng/src/i18n/lang/en-us-lang.json +++ b/src/ui_ng/src/i18n/lang/en-us-lang.json @@ -136,7 +136,8 @@ "DELETE_SUCCESS": "Users deleted successfully.", "ITEMS": "items", "OF": "of", - "RESET_Ok": "Users password reset successfully" + "RESET_Ok": "Users password reset successfully", + "EXISTING_PASSWORD": "The new password can not be same with the old one" }, "PROJECT": { "PROJECTS": "Projects", diff --git a/src/ui_ng/src/i18n/lang/es-es-lang.json b/src/ui_ng/src/i18n/lang/es-es-lang.json index 892ccf8a5..0c6565158 100644 --- a/src/ui_ng/src/i18n/lang/es-es-lang.json +++ b/src/ui_ng/src/i18n/lang/es-es-lang.json @@ -136,7 +136,8 @@ "DELETE_SUCCESS": "Usuario eliminado satisfactoriamente.", "ITEMS": "elementos", "OF": "of", - "RESET_Ok": "Users password reset successfully" + "RESET_Ok": "Users password reset successfully", + "EXISTING_PASSWORD": "The new password can not be same with the old one" }, "PROJECT": { "PROJECTS": "Proyectos", diff --git a/src/ui_ng/src/i18n/lang/fr-fr-lang.json b/src/ui_ng/src/i18n/lang/fr-fr-lang.json index aaed5b55e..f4c9e2ca1 100644 --- a/src/ui_ng/src/i18n/lang/fr-fr-lang.json +++ b/src/ui_ng/src/i18n/lang/fr-fr-lang.json @@ -119,7 +119,8 @@ "DELETE_SUCCESS": "Utilisateur supprimé avec succès.", "ITEMS": "items", "OF": "de", - "RESET_Ok": "Users password reset successfully" + "RESET_Ok": "Users password reset successfully", + "EXISTING_PASSWORD": "The new password can not be same with the old one" }, "PROJECT": { "PROJECTS": "Projets", diff --git a/src/ui_ng/src/i18n/lang/zh-cn-lang.json b/src/ui_ng/src/i18n/lang/zh-cn-lang.json index f3675cd27..48b3c2764 100644 --- a/src/ui_ng/src/i18n/lang/zh-cn-lang.json +++ b/src/ui_ng/src/i18n/lang/zh-cn-lang.json @@ -136,7 +136,8 @@ "DELETE_SUCCESS": "成功删除用户。", "OF": "共计", "ITEMS": "条记录", - "RESET_Ok": "成功修改用户密码" + "RESET_Ok": "成功修改用户密码", + "EXISTING_PASSWORD": "新密码不能与旧密码一致" }, "PROJECT": { "PROJECTS": "项目",