diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm
index 304568a6e..26ea55424 100644
--- a/lib/WebGUI/Auth.pm
+++ b/lib/WebGUI/Auth.pm
@@ -1102,7 +1102,7 @@ sub www_displayLogin {
my $self = shift;
my $method = $_[0] || "login";
my $vars = $_[1];
- print "Auth->www_displayLogin\n";
+
# Automatically set redirectAfterLogin unless we've linked here directly
# or it's already been set to perform another operation
unless (
@@ -1288,7 +1288,7 @@ Override this method in your subclass to change the initialization for custom au
sub www_view {
my $self = shift;
- return $self->displayLogin;
+ return $self->www_displayLogin;
}
deprecate init => 'www_view';
diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm
index 2cb3610a0..eb9f0d29c 100644
--- a/lib/WebGUI/Auth/WebGUI.pm
+++ b/lib/WebGUI/Auth/WebGUI.pm
@@ -773,7 +773,6 @@ The initial login screen an unauthenticated user sees
sub www_displayLogin {
my $self = shift;
my $vars;
- print "WebGUI->www_displayLogin\n";
return $self->www_displayAccount($_[0]) if ($self->isRegistered);
my $i18n = WebGUI::International->new($self->session);
$vars->{'login.message'} = '
' if ($_[0]);
diff --git a/lib/WebGUI/Deprecate.pm b/lib/WebGUI/Deprecate.pm
index 7352418ff..064a08c32 100644
--- a/lib/WebGUI/Deprecate.pm
+++ b/lib/WebGUI/Deprecate.pm
@@ -33,19 +33,33 @@ sub deprecate ($$) {
my $package = caller;
no strict 'refs';
no warnings 'redefine';
- *{"$package\::$old_method"} = \&{"$package\::$new_method"};
- my $proxy_method = sub {
- my $self = $_[0];
- my $sub = $self->can($old_method);
- my $class = ref $self || $self;
- if ($sub ne \&{"$package\::$old_method"}) {
- my $message = "$class contains the method $old_method. This has been deprecated and replaced with $new_method.";
- warn $message unless $warned{$message}++;
- $self->$new_method( @_ );
- }
- goto $sub;
+
+ my %deep;
+ # keep a copy since it will be replaced
+ my $new_sub = \&{"$package\::$new_method"};
+ # call new method instead. if
+ *{"$package\::$old_method"} = sub {
+ my $self = shift;
+ my $message = "$package\::$old_method is deprecated and should be replaced with $new_method at " . join( "-", (caller(0))[0,2] );
+ warn $message
+ unless $warned{$message}++;
+
+ local $deep{1} = 1;
+ $self->$new_method(@_);
+ };
+ *{"$package\::$new_method"} = sub {
+ my $self = $_[0];
+ if (!$deep{1}) {
+ my $old_sub = $self->can($old_method);
+ if ($old_sub ne \&{"$package\::$old_method"}) {
+ my $message = "Subclass of $package uses deprecated method $old_method, which should be replaced with $new_method";
+ carp $message
+ unless $warned{$message}++;
+ goto $old_sub;
+ }
+ }
+ goto $new_sub;
};
- *{"$package\::$new_method"} = $proxy_method;
}
1;
diff --git a/lib/WebGUI/Operation/Auth.pm b/lib/WebGUI/Operation/Auth.pm
index 4c3b818ec..2b96cf912 100644
--- a/lib/WebGUI/Operation/Auth.pm
+++ b/lib/WebGUI/Operation/Auth.pm
@@ -73,7 +73,7 @@ sub www_auth {
my $auth;
($auth) = $session->db->quickArray("select authMethod from users where username=".$session->db->quote($session->form->process("username"))) if($session->form->process("username"));
my $authMethod = getInstance($session,$auth);
- my $methodCall = shift || $session->form->process("method") || "init";
+ my $methodCall = shift || $session->form->process("method") || "view";
if(!$authMethod->isCallable($methodCall)){
$session->log->security("access uncallable auth method: $methodCall");
my $i18n = WebGUI::International->new($session);
diff --git a/t/Operation/Auth.t b/t/Operation/Auth.t
index d6d331628..14e194f4d 100644
--- a/t/Operation/Auth.t
+++ b/t/Operation/Auth.t
@@ -85,13 +85,15 @@ $session->user({ userId => 3 });
isa_ok(
WebGUI::Operation::Auth::getInstance( $session ),
'WebGUI::Auth::WebGUI',
- 'AuthType is defined by the logged-in user',
+ 'AuthType is defined by the logged-in user, despite being in request',
);
#----------------------------------------------------------------------------
# Test the web method for auth operation
# First a clean session, without an authenticated user
$session->user({ userId => 1 });
+$session->request->setup_body({});
+
my $output = WebGUI::Operation::Auth::www_auth($session);
like(
$output,