[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-132-g976bd6c

sartak at bestpractical.com sartak at bestpractical.com
Wed Feb 3 22:01:01 EST 2010


The branch, 3.8-trunk has been updated
       via  976bd6ca14b83bfd26a8c4e1fa6ddf87c0923092 (commit)
      from  1f70d8ba65e878a9ddc8afd0cdff63e3d33f0bfa (commit)

Summary of changes:
 share/html/Admin/Users/Modify.html |   25 ++++++++++++++++++++-----
 share/html/User/Prefs.html         |   21 +++++++++++++++++++--
 2 files changed, 39 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 976bd6ca14b83bfd26a8c4e1fa6ddf87c0923092
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Feb 3 22:00:31 2010 -0500

    Require your current password to change your/other's password

diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index aae38b1..b621bc2 100755
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -118,6 +118,14 @@
 <table>
 <tr>
 <td align="right">
+<&|/l&>Your Current Password</&>:
+</td>
+<td align="left">
+<input type="password" name="CurrentPass" autocomplete="off" />
+</td>
+</tr>
+<tr>
+<td align="right">
 <&|/l&>New Password</&>:
 </td>
 <td align="left">
@@ -368,17 +376,23 @@ if ( $UserObj->Id ) {
     my $password_not_set;
     # Deal with Password field
     if ( !$Pass1 and !$Pass2 ) {
-	$password_not_set = 1;
+        $password_not_set = 1;
+    } elsif (!$CurrentPass) {
+        $password_not_set = 1;
+        push @results, loc("Please specify your current password.");
+    } elsif (!$session{'CurrentUser'}->IsPassword($CurrentPass)) {
+        $password_not_set = 1;
+        push @results, loc("Please specify your current password correctly.");
     } elsif ( $Pass1 ne $Pass2 ) {
-	$password_not_set = 1;
+        $password_not_set = 1;
         push @results, loc("Passwords do not match.");
     } elsif ( $Pass1 eq $Pass2 and !$UserObj->IsPassword($Pass1) ) {
         my ($code, $msg) = $UserObj->SetPassword($Pass1);
         push @results, loc_fuzzy($msg);
-	$password_not_set = 1 unless $code;
+        $password_not_set = 1 unless $code;
     }
     if ($id eq 'new' and $password_not_set) {
-	push @results, loc("A password was not set, so user won't be able to login.");
+        push @results, loc("A password was not set, so user won't be able to login.");
     } 
 }
 
@@ -431,7 +445,8 @@ $City  => undef
 $State  => undef
 $Zip  => undef
 $Country => undef
+$CurrentPass => undef
 $Pass1 => undef
-$Pass2=> undef
+$Pass2 => undef
 $Create=> undef
 </%ARGS>
diff --git a/share/html/User/Prefs.html b/share/html/User/Prefs.html
index f52fdcb..8c900d0 100755
--- a/share/html/User/Prefs.html
+++ b/share/html/User/Prefs.html
@@ -112,6 +112,14 @@
 <table>
 <tr>
 <td class="label">
+<&|/l&>Your Current Password</&>:
+</td>
+<td class="value">
+<input type="password" name="CurrentPass" autocomplete="off"/>
+</td>
+</tr>
+<tr>
+<td class="label">
 <&|/l&>New Password</&>:
 </td>
 <td class="value">
@@ -260,7 +268,15 @@ if  ( $SetPrivileged and $Privileged != $UserObj->Privileged ) {
 }
 
 #TODO: make this report errors properly
-if ( defined $Pass1 and length $Pass1 and $Pass1 eq $Pass2 and !$UserObj->IsPassword($Pass1) ) {
+if (defined($Pass1) && length($Pass1) && !$UserObj->IsPassword($CurrentPass)) {
+    if (length($CurrentPass)) {
+        push @results, loc("Please specify your current password correctly. Your password has not been changed.");
+    }
+    else {
+        push @results, loc("Please specify your current password. Your password has not been changed.");
+    }
+}
+elsif ( defined $Pass1 and length $Pass1 and $Pass1 eq $Pass2 and !$UserObj->IsPassword($Pass1) ) {
     my ($code, $msg);
     ($code, $msg) = $UserObj->SetPassword($Pass1);
     push @results, loc('Password: [_1]', loc_fuzzy($msg));
@@ -308,7 +324,8 @@ $City  => undef
 $State  => undef
 $Zip  => undef
 $Country => undef
+$CurrentPass => undef
 $Pass1 => undef
-$Pass2=> undef
+$Pass2 => undef
 $Create=> undef
 </%ARGS>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list