From 6e118674b9340d3aad22d825786ae869aefe633e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 6 Sep 2022 10:57:20 +0800 Subject: [PATCH 1/2] * Fix bug #26193. --- module/my/js/changepassword.js | 14 +++++++++----- module/my/js/editprofile.js | 12 ++++++++---- module/my/view/changepassword.html.php | 2 +- module/my/view/editprofile.html.php | 2 +- module/user/js/create.js | 13 +++++++++---- module/user/js/edit.js | 9 +++++++-- module/user/js/reset.js | 4 +++- module/user/js/resetpassword.js | 9 +++++++-- module/user/view/create.html.php | 2 +- module/user/view/edit.html.php | 2 +- module/user/view/resetpassword.html.php | 2 +- 11 files changed, 48 insertions(+), 23 deletions(-) diff --git a/module/my/js/changepassword.js b/module/my/js/changepassword.js index d3d6b0014a..25f455269e 100644 --- a/module/my/js/changepassword.js +++ b/module/my/js/changepassword.js @@ -8,13 +8,17 @@ $(document).ready(function() $('#password1').change(function(){password1Encrypted = false}); $('#password2').change(function(){password2Encrypted = false}); + var passwordStrength = 0; $('#submit').click(function() { - var password = $('input#originalPassword').val().trim(); - var password1 = $('input#password1').val().trim(); - var passwordStrength = computePasswordStrength(password1); - var rand = $('input#verifyRand').val(); - if(!password1Encrypted) $("#passwordLength").val(password1.length); + var password = $('input#originalPassword').val().trim(); + var password1 = $('input#password1').val().trim(); + var rand = $('input#verifyRand').val(); + if(!password1Encrypted) + { + passwordStrength = computePasswordStrength(password1); + $("#passwordLength").val(password1.length); + } if($("form input[name=passwordStrength]").length == 0) $('#submit').after(""); $("form input[name=passwordStrength]").val(passwordStrength); diff --git a/module/my/js/editprofile.js b/module/my/js/editprofile.js index aa60cedfa6..3d91b9161c 100644 --- a/module/my/js/editprofile.js +++ b/module/my/js/editprofile.js @@ -8,12 +8,16 @@ $(document).ready(function() $('#password1').change(function(){password1Encrypted = false}); $('#password2').change(function(){password2Encrypted = false}); + var passwordStrength = 0; $('#submit').click(function() { - var password = $('input#verifyPassword').val(); - var password1 = $('input#password1').val(); - var passwordStrength = computePasswordStrength(password1); - if(!password1Encrypted) $("#passwordLength").val(password1.length); + var password = $('input#verifyPassword').val(); + var password1 = $('input#password1').val(); + if(!password1Encrypted) + { + passwordStrength = computePasswordStrength(password1); + $("#passwordLength").val(password1.length); + } if($("form input[name=passwordStrength]").length == 0) $('#submit').after(""); $("form input[name=passwordStrength]").val(passwordStrength); diff --git a/module/my/view/changepassword.html.php b/module/my/view/changepassword.html.php index 4fc172707a..3d14b5ae17 100755 --- a/module/my/view/changepassword.html.php +++ b/module/my/view/changepassword.html.php @@ -35,7 +35,7 @@ user->newPassword;?> - user->placeholder->passwordStrength, $config->safe->mode, '') . "'");?> + user->placeholder->passwordStrength, $config->safe->mode, '') . "'");?> diff --git a/module/my/view/editprofile.html.php b/module/my/view/editprofile.html.php index 45d197587a..5d286ef4e6 100644 --- a/module/my/view/editprofile.html.php +++ b/module/my/view/editprofile.html.php @@ -46,7 +46,7 @@ - safe->mode) ? $lang->user->placeholder->passwordStrength[$config->safe->mode] : '') . "'");?> + safe->mode) ? $lang->user->placeholder->passwordStrength[$config->safe->mode] : '') . "'");?> diff --git a/module/user/js/create.js b/module/user/js/create.js index 32c6596e9a..111660bdba 100644 --- a/module/user/js/create.js +++ b/module/user/js/create.js @@ -90,14 +90,19 @@ $(function() var password2Encrypted = false $('#password1').change(function(){password1Encrypted = false}); $('#password2').change(function(){password2Encrypted = false}); + + var passwordStrength = 0; $('#submit').click(function() { if(!password1Encrypted || !password2Encrypted) { - var password1 = $('#password1').val(); - var password2 = $('#password2').val(); - var passwordStrength = computePasswordStrength(password1); - if(!password1Encrypted) $("#passwordLength").val(password1.length); + var password1 = $('#password1').val(); + var password2 = $('#password2').val(); + if(!password1Encrypted) + { + passwordStrength = computePasswordStrength(password1); + $("#passwordLength").val(password1.length); + } if($("form input[name=passwordStrength]").length == 0) $('#submit').after(""); $("form input[name=passwordStrength]").val(passwordStrength); diff --git a/module/user/js/edit.js b/module/user/js/edit.js index 6b673efc4e..3b3501e708 100644 --- a/module/user/js/edit.js +++ b/module/user/js/edit.js @@ -4,14 +4,19 @@ $(function() var password2Encrypted = false $('#password1').change(function(){password1Encrypted = false}); $('#password2').change(function(){password2Encrypted = false}); + + var passwordStrength = 0; $('#submit').click(function() { if(!password1Encrypted || !password2Encrypted) { var password1 = $('#password1').val().trim(); var password2 = $('#password2').val().trim(); - var passwordStrength = computePasswordStrength(password1); - if(!password1Encrypted) $("#passwordLength").val(password1.length); + if(!password1Encrypted) + { + passwordStrength = computePasswordStrength(password1); + $("#passwordLength").val(password1.length); + } if($("form input[name=passwordStrength]").length == 0) $('#submit').after(""); $("form input[name=passwordStrength]").val(passwordStrength); diff --git a/module/user/js/reset.js b/module/user/js/reset.js index ccf8593186..7102b85dfc 100644 --- a/module/user/js/reset.js +++ b/module/user/js/reset.js @@ -4,13 +4,15 @@ $(document).ready(function() var password2Encrypted = false $('#password1').change(function(){password1Encrypted = false}); $('#password2').change(function(){password2Encrypted = false}); + + var passwordStrength = 0; $('form #submit').click(function() { if(!password1Encrypted || !password2Encrypted) { var password1 = $('#password1').val().trim(); var password2 = $('#password2').val().trim(); - var passwordStrength = computePasswordStrength(password1); + if(!password1Encrypted) passwordStrength = computePasswordStrength(password1); if($("form input[name=passwordStrength]").length == 0) $('#submit').after(""); $("form input[name=passwordStrength]").val(passwordStrength); diff --git a/module/user/js/resetpassword.js b/module/user/js/resetpassword.js index 9f328f6445..1171ac177a 100644 --- a/module/user/js/resetpassword.js +++ b/module/user/js/resetpassword.js @@ -14,14 +14,19 @@ $(function() var password2Encrypted = false $('#password1').change(function(){password1Encrypted = false}); $('#password2').change(function(){password2Encrypted = false}); + + var passwordStrength = 0; $('#submit').click(function() { if(!password1Encrypted || !password2Encrypted) { var password1 = $('#password1').val().trim(); var password2 = $('#password2').val().trim(); - var passwordStrength = computePasswordStrength(password1); - if(!password1Encrypted) $("#passwordLength").val(password1.length); + if(!password1Encrypted) + { + passwordStrength = computePasswordStrength(password1); + $("#passwordLength").val(password1.length); + } if($("form input[name=passwordStrength]").length == 0) $('#submit').after(""); $("form input[name=passwordStrength]").val(passwordStrength); diff --git a/module/user/view/create.html.php b/module/user/view/create.html.php index 44f22cf2c7..3dfb8c9930 100644 --- a/module/user/view/create.html.php +++ b/module/user/view/create.html.php @@ -54,7 +54,7 @@ $showVisionList = count($visionList) > 1; - + diff --git a/module/user/view/edit.html.php b/module/user/view/edit.html.php index 8306b1f4c1..091daed83d 100644 --- a/module/user/view/edit.html.php +++ b/module/user/view/edit.html.php @@ -71,7 +71,7 @@ - user->placeholder->passwordStrength, $config->safe->mode, '') . "'");?> + user->placeholder->passwordStrength, $config->safe->mode, '') . "'");?> diff --git a/module/user/view/resetpassword.html.php b/module/user/view/resetpassword.html.php index 7279f8dfb6..8b5e454fc4 100644 --- a/module/user/view/resetpassword.html.php +++ b/module/user/view/resetpassword.html.php @@ -29,7 +29,7 @@ include '../../common/view/header.lite.html.php';
- user->placeholder->loginPassword, $config->safe->mode, '') . "' onmouseup='checkPassword(this.value)' onkeyup='checkPassword(this.value)'");?> + user->placeholder->loginPassword, $config->safe->mode, '') . "' onkeyup='checkPassword(this.value)'");?>
From b7fa4bd754acf63dcef29e73c05f4f589b00fe9d Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 6 Sep 2022 15:30:21 +0800 Subject: [PATCH 2/2] * Fix bug #26193. --- module/my/control.php | 5 ++--- module/my/view/editprofile.html.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index fa751be570..3c9240313d 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1212,9 +1212,8 @@ EOF; $_POST['account'] = $this->app->user->account; $_POST['groups'] = $this->dao->select('`group`')->from(TABLE_USERGROUP)->where('account')->eq($this->post->account)->fetchPairs('group', 'group'); $this->user->update($this->app->user->id); - if(dao::isError()) helper::end(js::error(dao::getError())); - echo js::locate($this->createLink('my', 'profile'), 'parent'); - return; + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('my', 'profile'), 'closeModal' => true)); } $this->app->loadConfig('user'); diff --git a/module/my/view/editprofile.html.php b/module/my/view/editprofile.html.php index 5d286ef4e6..962686cbbc 100644 --- a/module/my/view/editprofile.html.php +++ b/module/my/view/editprofile.html.php @@ -17,7 +17,7 @@

my->editProfile;?>

-
+
my->form->lblBasic;?>