diff options
Diffstat (limited to 'rt/share/html/SelfService/Prefs.html')
-rwxr-xr-x | rt/share/html/SelfService/Prefs.html | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/rt/share/html/SelfService/Prefs.html b/rt/share/html/SelfService/Prefs.html index dabab7937..468a3d508 100755 --- a/rt/share/html/SelfService/Prefs.html +++ b/rt/share/html/SelfService/Prefs.html @@ -50,13 +50,14 @@ <& /Elements/ListActions, actions => \@results &> <form method="post"> -% unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) { <&| /Widgets/TitleBox, title => loc('Change password') &> -<&|/l&>New password</&>: <input type="password" name="NewPass1" size="16" autocomplete="off" /> -<&|/l&>Confirm</&>: <input type="password" name="NewPass2" size="16" autocomplete="off" /> +<& /Elements/EditPassword, + User => $user, + Name => [qw(CurrentPass NewPass1 NewPass2)], +&> </&> + <br /> -% } <& /Elements/Submit, Label => loc('Save Changes') &> </form> @@ -64,29 +65,32 @@ <%INIT> my @results; -if ($NewPass1) { - if ($NewPass1 ne $NewPass2) { - push (@results, "Passwords did not match."); - } - else { - my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetPassword($NewPass1); - push (@results, "Password: ".$msg); - } +my $user = $session{'CurrentUser'}->UserObj; + +if (defined $NewPass1 && length $NewPass1 ) { + my ($status, $msg) = $user->SafeSetPassword( + Current => $CurrentPass, + New => $NewPass1, + Confirmation => $NewPass2, + ); + push @results, loc("Password: [_1]", $msg); } + if ($Signature) { $Signature =~ s/(\r\n|\r)/\n/g; - if ($Signature ne $session{'CurrentUser'}->UserObj->Signature) { - my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetSignature($Signature); + if ($Signature ne $user->Signature) { + my ($val, $msg) = $user->SetSignature($Signature); push (@results, "Signature: ".$msg); } } -#A hack to make sure that session gets rewritten. +#A hack to make sure that session gets rewritten. $session{'i'}++; </%INIT> <%ARGS> $Signature => undef +$CurrentPass => undef $NewPass1 => undef $NewPass2 => undef </%ARGS> |