1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
<%INIT>
if ( ( $ARGS{'SendPasswordResetEmail'} || $session{'SendPasswordResetEmail'} ) && $User && $User->Id ) {
if ( $ARGS{'Pass1'} or $ARGS{'Pass2'} ) {
# If the password is reset and the new password link is sent, the token
# won't match, so don't send the email.
push @{$Results}, 'Password reset email not sent: cannot send password reset email and then reset user password. Resubmit with password fields blank to send password reset email.';
return;
}
my ($ret, $msg) = RT::Extension::ResetPassword::CreateTokenAndResetPassword($User);
if ( $ret ) {
push @{$Results}, 'Password reset email passed to new user';
}
else {
RT::Logger->error( "$msg" );
}
}
delete $session{'SendPasswordResetEmail'};
# Handle DeleteUserPassword
if ( $ARGS{'DeleteUserPassword'} ) {
my ($ret, $msg) = $User->UnsetPassword();
if ( $ret ) {
push @{$Results}, $msg;
}
else {
push @{$Results}, 'Unable to delete password';
RT::Logger->error( "$msg" );
}
}
</%INIT>
<%ARGS>
$Results
$User
$ARGSRef
</%ARGS>
|