X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F05_Authentication.pod;h=ec3a748f58617084f29dd7a4052767fbb3ecfb0a;hp=8c3523e53afcaffb66fa10bc8a1f76b3d7c7c9da;hb=ab0bd0bb5e2a7d8d3e355ca3524a61c3d4c59fd6;hpb=6290bf87f4960688b5aec32fc762886031e9db09 diff --git a/lib/Catalyst/Manual/Tutorial/05_Authentication.pod b/lib/Catalyst/Manual/Tutorial/05_Authentication.pod index 8c3523e..ec3a748 100644 --- a/lib/Catalyst/Manual/Tutorial/05_Authentication.pod +++ b/lib/Catalyst/Manual/Tutorial/05_Authentication.pod @@ -388,11 +388,11 @@ and update the definition of C to match: my ($self, $c) = @_; # Get the username and password from form - my $username = $c->request->params->{username} || ""; - my $password = $c->request->params->{password} || ""; + my $username = $c->request->params->{username}; + my $password = $c->request->params->{password}; # If the username and password values were found in form - if (defined($username) && defined($password)) { + if ($username && $password) { # Attempt to log the user in if ($c->authenticate({ username => $username, password => $password } )) { @@ -404,6 +404,9 @@ and update the definition of C to match: # Set an error message $c->stash->{error_msg} = "Bad username or password."; } + } else { + # Set an error message + $c->stash->{error_msg} = "Empty username or password."; } # If either of above don't work out, send to the login page @@ -738,7 +741,7 @@ Then run the following command: $ DBIC_TRACE=1 perl -Ilib set_hashed_passwords.pl -We had to use the C<-Ilib> arguement to tell perl to look under the +We had to use the C<-Ilib> argument to tell perl to look under the C directory for our C model. The DBIC_TRACE output should show that the update worked: