forward port of bugfix from 7.3.21

This commit is contained in:
Doug Bell 2007-07-14 00:04:20 +00:00
parent f07858a645
commit 15e3894b86
4 changed files with 77 additions and 40 deletions

View file

@ -72,6 +72,9 @@
- add: Password recovery can now be based on profile fields or simply by the - add: Password recovery can now be based on profile fields or simply by the
user's e-mail address. user's e-mail address.
7.3.21
- fix: Self-deactivation doesn't show login screen after success
7.3.20 7.3.20
- Added beta label to the beta components in the system, so people can more - Added beta label to the beta components in the system, so people can more
easily tell which parts of the system are a work in progress. easily tell which parts of the system are a work in progress.

View file

@ -337,7 +337,7 @@ sub deactivateAccount {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 deactivateAccountConfirm ( method ) =head2 deactivateAccountConfirm ( )
Superclass method that performs general functionality for deactivating accounts. Superclass method that performs general functionality for deactivating accounts.
@ -345,18 +345,35 @@ Superclass method that performs general functionality for deactivating accounts.
sub deactivateAccountConfirm { sub deactivateAccountConfirm {
my $self = shift; my $self = shift;
return $self->session->privilege->vitalComponent() if($self->userId eq '1' || $self->userId eq '3');
my $u = $self->user; # Cannot deactivate "Visitor" or "Admin" users this way
$u->status("Selfdestructed"); return $self->session->privilege->vitalComponent
$self->session->var->end(); if $self->userId eq '1' || $self->userId eq '3';
$self->session->user({userId=>'1'});
my $i18n = WebGUI::International->new($self->session);
# Change user's status
my $user = $self->user;
$user->status("Selfdestructed");
# TODO: Fix displayLogin in all subclasses to have the same prototype. THIS WILL BREAK API!
# Show the login form
#$self->logout;
#return $self->displayLogin(undef, {
#'login.message' => sprintf( $i18n->get("deactivateAccount success"), $user->username )
#});
$self->logout;
return undef;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 deleteParams ( ) =head2 deleteParams ( )
Removes the user's authentication parameters from the database for all authentication methods. This is primarily useful when deleting the user's account. Removes the user's authentication parameters from the database for all
authentication methods. This is primarily useful when deleting the user's
account.
=cut =cut

View file

@ -265,7 +265,19 @@ sub deactivateAccount {
sub deactivateAccountConfirm { sub deactivateAccountConfirm {
my $self = shift; my $self = shift;
return $self->displayLogin unless ($self->session->setting->get("selfDeactivation")); return $self->displayLogin unless ($self->session->setting->get("selfDeactivation"));
return $self->SUPER::deactivateAccountConfirm;
# Keep the username for a nice message
my $username = $self->user->username;
# Deactivate the account
my $response = $self->SUPER::deactivateAccountConfirm;
# If there was a response, it's probably an error
return $response if $response;
# Otherwise show the login form with a friendly message
my $i18n = WebGUI::International->new($self->session);
return $self->displayLogin(sprintf( $i18n->get("deactivateAccount success"), $username ));
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -4262,6 +4262,11 @@ Get a copy of wget and use this: <code>wget -p -r --html-extension -k http://the
lastUpdated => 0, lastUpdated => 0,
}, },
'deactivateAccount success' => {
message => q{%s has been deactivated},
lastUpdated => 0,
},
}; };
1; 1;