From b9a1b97e0e7720f369d47a6251565c443612178c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= Date: Mon, 19 Dec 2022 14:24:40 +0300 Subject: [PATCH 1/2] added hide show button --- .../Password/Default.cshtml | 11 +++++---- .../Password/Default.js | 23 +++++++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml index febab6d081..bb85cc641c 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml @@ -9,9 +9,10 @@
@if (!Model.HideOldPasswordInput) { - + } - - - - + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js index e2f2fd4969..473cfc1d81 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js @@ -1,10 +1,25 @@ (function ($) { + $("#PasswordVisibilityButton").click(function (e) { + let button = $(this); + let passwordInput = button.parent().find("input"); + if (!passwordInput) { + return; + } + if (passwordInput.attr("type") === "password") { + passwordInput.attr("type", "text"); + } + else { + passwordInput.attr("type", "password"); + } + let icon = button.find("i"); + if (icon) { + icon.toggleClass("fa-eye-slash").toggleClass("fa-eye"); + } + }); $(function () { var l = abp.localization.getResource("AbpAccount"); - $('#ChangePasswordForm').submit(function (e) { e.preventDefault(); - if (!$('#ChangePasswordForm').valid()) { return false; } @@ -19,11 +34,11 @@ return; } - if (input.currentPassword && input.currentPassword == ''){ + if (input.currentPassword && input.currentPassword == '') { return; } - if(input.currentPassword == input.newPassword) { + if (input.currentPassword == input.newPassword) { abp.message.error(l('NewPasswordSameAsOld')); return; } From 016017c050c94add500fb9477366a05c2ad4e5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20P=C4=B1=C3=A7akc=C4=B1?= Date: Mon, 19 Dec 2022 15:40:46 +0300 Subject: [PATCH 2/2] password show/hide edited --- .../Password/Default.cshtml | 33 ++++++++++++++----- .../Password/Default.js | 10 ++++-- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml index bb85cc641c..e012bdd3f4 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.cshtml @@ -5,14 +5,31 @@ @inject ICurrentUser CurrentUser @model Volo.Abp.Account.Web.Pages.Account.Components.ProfileManagementGroup.Password.AccountProfilePasswordManagementGroupViewComponent.ChangePasswordInfoModel -

@L["ChangePassword"]


+

@L["ChangePassword"]


- @if (!Model.HideOldPasswordInput) - { - - } - - - +
+ @if (!Model.HideOldPasswordInput) + { + +
+ + +
+
+ } + +
+ + +
+
+ + +
+ + +
+ +
\ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js index 473cfc1d81..ec23761729 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js @@ -1,25 +1,29 @@ (function ($) { - $("#PasswordVisibilityButton").click(function (e) { + $(".password-visibility-button").click(function (e) { let button = $(this); let passwordInput = button.parent().find("input"); if (!passwordInput) { return; } + if (passwordInput.attr("type") === "password") { passwordInput.attr("type", "text"); } else { passwordInput.attr("type", "password"); } + let icon = button.find("i"); if (icon) { icon.toggleClass("fa-eye-slash").toggleClass("fa-eye"); } }); + $(function () { var l = abp.localization.getResource("AbpAccount"); $('#ChangePasswordForm').submit(function (e) { e.preventDefault(); + if (!$('#ChangePasswordForm').valid()) { return false; } @@ -37,12 +41,12 @@ if (input.currentPassword && input.currentPassword == '') { return; } - + if (input.currentPassword == input.newPassword) { abp.message.error(l('NewPasswordSameAsOld')); return; } - + volo.abp.account.profile.changePassword(input).then(function (result) { abp.message.success(l('PasswordChanged')); abp.event.trigger('passwordChanged');