summaryrefslogtreecommitdiff
path: root/rt/share/html/User
diff options
context:
space:
mode:
Diffstat (limited to 'rt/share/html/User')
-rwxr-xr-xrt/share/html/User/Elements/Tabs66
-rwxr-xr-xrt/share/html/User/Prefs.html43
2 files changed, 50 insertions, 59 deletions
diff --git a/rt/share/html/User/Elements/Tabs b/rt/share/html/User/Elements/Tabs
index 48cf1808b..7f9aca4dd 100755
--- a/rt/share/html/User/Elements/Tabs
+++ b/rt/share/html/User/Elements/Tabs
@@ -52,41 +52,43 @@
Title => $Title &>
<%INIT>
- my $tabs = {
-
- a => { title => loc('Settings'),
- path => 'Prefs/Other.html',
- },
-
- b => { title => loc('About me'),
- path => 'User/Prefs.html',
- },
- g => { title => loc('Personal Groups'),
- path => 'User/Groups/',
- },
- h => { title => loc('Delegation'),
- path => 'User/Delegation.html',
- },
- f => { title => loc('Search options'),
- path => 'Prefs/SearchOptions.html',
- },
- r => { title => loc('RT at a glance'),
- path => 'Prefs/MyRT.html',
- },
- };
+my $tabs = {
+ a => {
+ title => loc('Settings'),
+ path => 'Prefs/Other.html',
+ },
+ b => {
+ title => loc('About me'),
+ path => 'User/Prefs.html',
+ },
+ g => {
+ title => loc('Personal Groups'),
+ path => 'User/Groups/',
+ },
+ h => {
+ title => loc('Delegation'),
+ path => 'User/Delegation.html',
+ },
+ f => {
+ title => loc('Search options'),
+ path => 'Prefs/SearchOptions.html',
+ },
+ r => {
+ title => loc('RT at a glance'),
+ path => 'Prefs/MyRT.html',
+ },
+};
- # Now let callbacks add their extra tabs
- $m->callback( %ARGS, tabs => $tabs );
-
- foreach my $tab (sort keys %{$tabs}) {
- if ($tabs->{$tab}->{'path'} eq $current_tab) {
- $tabs->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{$tab}->{"current_subtab"} = $current_subtab;
- }
- }
-</%INIT>
+# Now let callbacks add their extra tabs
+$m->callback( %ARGS, tabs => $tabs );
+foreach my $tab (values %$tabs) {
+ next unless $tab->{'path'} eq $current_tab;
+ $tab->{"subtabs"} = $subtabs;
+ $tab->{"current_subtab"} = $current_subtab;
+}
+</%INIT>
<%ARGS>
$subtabs => undef
$current_tab => undef
diff --git a/rt/share/html/User/Prefs.html b/rt/share/html/User/Prefs.html
index f52fdcbdf..884cf85e4 100755
--- a/rt/share/html/User/Prefs.html
+++ b/rt/share/html/User/Prefs.html
@@ -107,27 +107,13 @@
% $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormLeftColumn' );
</td>
<td valign="top" class="boxcontainer">
-% unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) {
+
<&| /Widgets/TitleBox, title => loc('Password'), id => "user-prefs-password" &>
-<table>
-<tr>
-<td class="label">
-<&|/l&>New Password</&>:
-</td>
-<td class="value">
-<input type="password" name="Pass1" autocomplete="off"/>
-</td>
-</tr>
-<tr><td class="label">
-<&|/l&>Retype Password</&>:
-</td>
-<td class="value">
-<input type="password" name="Pass2" autocomplete="off" />
-</td>
-</tr>
-</table>
+<& /Elements/EditPassword,
+ User => $UserObj,
+ Name => [qw(CurrentPass Pass1 Pass2)],
+&>
</&>
-% }
<&| /Widgets/TitleBox, title => loc('Location'), id => "user-prefs-location" &>
<table cellspacing="0" cellpadding="0">
@@ -221,6 +207,7 @@ unless ( $UserObj->id ) {
if $Name;
Abort(loc("Couldn't load user"));
}
+$id = $UserObj->id;
my @results;
@@ -259,13 +246,14 @@ if ( $SetPrivileged and $Privileged != $UserObj->Privileged ) {
push @results, loc('Privileged status: [_1]', loc_fuzzy($msg));
}
-#TODO: make this report errors properly
-if ( 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));
-} elsif ( defined $Pass1 && length $Pass1 && $Pass1 ne $Pass2 ) {
- push @results, loc("Passwords do not match. Your password has not been changed");
+my %password_cond = $UserObj->CurrentUserRequireToSetPassword;
+if (defined $Pass1 && length $Pass1 ) {
+ my ($status, $msg) = $UserObj->SafeSetPassword(
+ Current => $CurrentPass,
+ New => $Pass1,
+ Confirmation => $Pass2,
+ );
+ push @results, loc("Password: [_1]", $msg);
}
if ( $ARGS{'ResetAuthToken'} ) {
@@ -308,7 +296,8 @@ $City => undef
$State => undef
$Zip => undef
$Country => undef
+$CurrentPass => undef
$Pass1 => undef
-$Pass2=> undef
+$Pass2 => undef
$Create=> undef
</%ARGS>