WebGUI::Session::Scratch->delete now acts more like Perl's delete()fix: redirectAfterLogin wouldn't work if displayLogin called from WebGUI::Operation::execute

This commit is contained in:
Doug Bell 2006-11-07 08:13:23 +00:00
parent 776a6bfdcc
commit e68f609850
3 changed files with 22 additions and 4 deletions

View file

@ -42,6 +42,9 @@
- fix: WebGUI::Operation::ProductManager added a tab with wrong name.
- fix: WebGUI::Operation::Commerce www_selectPaymentGateway no longer forces
user to choose gateway if they are only authorized to use one
- WebGUI::Session::Scratch->delete now returns the value deleted for
convenience, like Perl's built-in delete() function.
- fix: Auth redirectOnLogin wouldn't work if login called from Operation::execute()
7.1.3
- fix: SQLReport now returns error if can't find DatabaseLink

View file

@ -242,7 +242,6 @@ sub createAccountSave {
}
$self->session->user({user=>$u});
$self->_logLogin($userId,"success");
$self->session->http->setStatus(201,"Account Registration Successful");
if ($self->session->setting->get("runOnRegistration")) {
WebGUI::Workflow::Instance->create($self->session, {
workflowId=>$self->session->setting->get("runOnRegistration"),
@ -252,6 +251,17 @@ sub createAccountSave {
priority=>1
});
}
# If we have a redirectOnLogin, redirect the user
if ($self->session->scratch->get("redirectOnLogin")) {
my $url = $self->session->scratch->delete("redirectOnLogin");
$self->session->http->setRedirect($url);
} else {
$self->session->http->setStatus(201,"Account Registration Successful");
}
return undef;
}
@ -371,7 +381,10 @@ sub displayLogin {
my $self = shift;
my $method = $_[0] || "login";
my $vars = $_[1];
unless ($self->session->form->process("op") eq "auth") {
# Automatically set redirectAfterLogin unless we've linked here directly
# or it's already been set.
unless ($self->session->form->process("op") eq "auth"
|| $self->session->scratch->get("redirectAfterLogin") ) {
$self->session->scratch->set("redirectAfterLogin",$self->session->url->page($self->session->env->get("QUERY_STRING")));
}
my $i18n = WebGUI::International->new($self->session);

View file

@ -48,7 +48,8 @@ These methods are available from this package:
=head2 delete ( name )
Deletes a scratch variable.
Deletes a scratch variable. Returns the value of the deleted variable for
convenience, or undef if the variable was not defined.
=head3 name
@ -60,8 +61,9 @@ sub delete {
my $self = shift;
my $name = shift;
return undef unless ($name);
delete $self->{_data}{$name};
my $value = delete $self->{_data}{$name};
$self->session->db->write("delete from userSessionScratch where name=? and sessionId=?", [$name, $self->session->getId]);
return $value;
}