[Bps-public-commit] rt-extension-resetpassword branch, new-user-create-password, repushed
Craig Kaiser
craig at bestpractical.com
Thu Jan 9 16:20:59 EST 2020
The branch new-user-create-password was deleted and repushed:
was 46c26c73c6ac2a9cb1f5b20927f777f1d5335ba0
now 6b667c9be05d5b3d711d0a308810b8d9d0855e0b
1: 5d80792 = 1: 5d80792 Move token generation and password reset to lib method
2: a8ae09d ! 2: 70ebfd1 Allow for users to create priv user records with no account
@@ -101,10 +101,7 @@
+ push @actions, loc("You can't reset your password because your user is disabled.");
+ RT->Logger->warning("Disabled user " . $u->Name . " attempted to reset password");
+ } elsif ($u->id and not $u->Privileged) {
-+ my ($status, $msg) = $u->SetPrivileged(1);
-+ RT::Logger->error($msg) unless $status;
-+
-+ ($status, $msg) = RT::Extension::ResetPassword->CreateTokenAndResetPassword($u);
++ my ($status, $msg) = RT::Extension::ResetPassword->CreateTokenAndResetPassword($u);
+ if ($status) {
+ push @actions, loc("RT has sent you an email message with instructions about how to reset your password");
+ RT->Logger->info("Password reset token send to " . $u->EmailAddress);
@@ -114,7 +111,7 @@
+ }
+ } else {
+ my ($status, $msg) = $u->Create(
-+ Privileged => 1,
++ Privileged => RT::Config->Get('CreateNewsUserAsPrivileged') || 0,
+ EmailAddress => $ARGS{'Email'},
+ );
+ RT::Logger->error($msg) unless $status;
@@ -135,3 +132,20 @@
+}
+</%INIT>
+diff --git a/lib/RT/Extension/ResetPassword.pm b/lib/RT/Extension/ResetPassword.pm
+--- a/lib/RT/Extension/ResetPassword.pm
++++ b/lib/RT/Extension/ResetPassword.pm
+@@
+ not revealing the reasons for any failure. All failures will still be
+ logged with an appropriate diagnostic message.
+
++=item C<$CreateNewsUserAsPrivileged>
++
++Set this config value to true if users creating a new account should default to privileged users.
++
++=cut
++
+ =head1 AUTHOR
+
+ Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
+
3: 30eae48 < -: ------- Config option for if a new user created on password set should be privileged
4: 46c26c7 ! 3: 6b667c9 Config option for creating a user on password set if no user record exists
@@ -24,7 +24,7 @@
}
} else {
- my ($status, $msg) = $u->Create(
-- Privileged => 1,
+- Privileged => RT::Config->Get('CreateNewsUserAsPrivileged') || 0,
- EmailAddress => $ARGS{'Email'},
- );
- RT::Logger->error($msg) unless $status;
More information about the Bps-public-commit
mailing list