use double bracketed formatting codes so < and > don't need to be escaped
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial / 05_Authentication.pod
index f3f0f12..75c1482 100644 (file)
@@ -63,7 +63,7 @@ L<Chapter 6|Catalyst::Manual::Tutorial::06_Authorization>).
 This chapter of the tutorial is divided into two main sections: 1)
 basic, cleartext authentication and 2) hash-based authentication.
 
-Source code for the tutorial in included in the F</root/Final> directory
+Source code for the tutorial in included in the F</home/catalyst/Final> directory
 of the Tutorial Virtual machine (one subdirectory per chapter).  There
 are also instructions for downloading the code in
 L<Catalyst::Manual::Tutorial::01_Intro>.
@@ -132,11 +132,11 @@ for us:
     $ script/myapp_create.pl model DB DBIC::Schema MyApp::Schema \
         create=static components=TimeStamp dbi:SQLite:myapp.db \
         on_connect_do="PRAGMA foreign_keys = ON"
-     exists "/root/dev/MyApp/script/../lib/MyApp/Model"
-     exists "/root/dev/MyApp/script/../t"
-    Dumping manual schema for MyApp::Schema to directory /root/dev/MyApp/script/../lib ...
+     exists "/home/catalyst/dev/MyApp/script/../lib/MyApp/Model"
+     exists "/home/catalyst/dev/MyApp/script/../t"
+    Dumping manual schema for MyApp::Schema to directory /home/catalyst/dev/MyApp/script/../lib ...
     Schema dump completed.
-     exists "/root/dev/MyApp/script/../lib/MyApp/Model/DB.pm"
+     exists "/home/catalyst/dev/MyApp/script/../lib/MyApp/Model/DB.pm"
     $
     $ ls lib/MyApp/Schema/Result
     Author.pm  BookAuthor.pm  Book.pm  Role.pm  User.pm  UserRole.pm
@@ -225,11 +225,11 @@ C<StackTrace> is new):
         -Debug
         ConfigLoader
         Static::Simple
-    
+
         StackTrace
-    
+
         Authentication
-    
+
         Session
         Session::Store::File
         Session::State::Cookie
@@ -281,7 +281,7 @@ sets a reasonable set of defaults for us.  (Note: the C<SimpleDB> here
 has nothing to do with the SimpleDB offered in Amazon's web services
 offerings -- here we are only talking about a "simple" way to use your
 DB as an authentication backend.)  Open C<lib/MyApp.pm> and place the
-following text above the call to C<__PACKAGE__-E<gt>setup();>:
+following text above the call to C<< __PACKAGE__->setup(); >>:
 
     # Configure SimpleDB Authentication
     __PACKAGE__->config(
@@ -324,7 +324,7 @@ B<HOWEVER>, if you try out the command above, be sure to delete the
 configurations.
 
 B<NOTE:> Because we are using
-L<SimpleDB|L<Catalyst::Authentication::Realm::SimpleDB> along with a
+L<SimpleDB|Catalyst::Authentication::Realm::SimpleDB> along with a
 database layout that complies with its default assumptions: we don't
 need to specify the names of the columns where our username and password
 information is stored (hence, the "Simple" part of "SimpleDB").  That
@@ -349,18 +349,18 @@ Then open C<lib/MyApp/Controller/Login.pm>, and update the definition of
 C<sub index> to match:
 
     =head2 index
-    
+
     Login logic
-    
+
     =cut
-    
+
     sub index :Path :Args(0) {
         my ($self, $c) = @_;
-    
+
         # Get the username and password from form
         my $username = $c->request->params->{username};
         my $password = $c->request->params->{password};
-    
+
         # If the username and password values were found in form
         if ($username && $password) {
             # Attempt to log the user in
@@ -379,7 +379,7 @@ C<sub index> to match:
             $c->stash(error_msg => "Empty username or password.")
                 unless ($c->user_exists);
         }
-    
+
         # If either of above don't work out, send to the login page
         $c->stash(template => 'login.tt2');
     }
@@ -411,17 +411,17 @@ Next, update the corresponding method in
 C<lib/MyApp/Controller/Logout.pm> to match:
 
     =head2 index
-    
+
     Logout logic
-    
+
     =cut
-    
+
     sub index :Path :Args(0) {
         my ($self, $c) = @_;
-    
+
         # Clear the user's state
         $c->logout;
-    
+
         # Send the user to the starting point
         $c->response->redirect($c->uri_for('/'));
     }
@@ -432,7 +432,7 @@ C<lib/MyApp/Controller/Logout.pm> to match:
 Create a login form by opening C<root/src/login.tt2> and inserting:
 
     [% META title = 'Login' %]
-    
+
     <!-- Login form -->
     <form method="post" action="[% c.uri_for('/login') %]">
       <table>
@@ -463,17 +463,17 @@ Edit the existing C<lib/MyApp/Controller/Root.pm> class file and insert
 the following method:
 
     =head2 auto
-    
+
     Check if there is a user and, if not, forward to login page
-    
+
     =cut
-    
+
     # Note that 'auto' runs after 'begin' but before your actions and that
     # 'auto's "chain" (all from application path to most specific class are run)
     # See the 'Actions' section of 'Catalyst::Manual::Intro' for more info.
     sub auto :Private {
         my ($self, $c) = @_;
-    
+
         # Allow unauthenticated users to reach the login page.  This
         # allows unauthenticated users to reach any action in the Login
         # controller.  To lock it down to a single action, we could use:
@@ -483,7 +483,7 @@ the following method:
         if ($c->controller eq $c->controller('Login')) {
             return 1;
         }
-    
+
         # If a user doesn't exist, force login
         if (!$c->user_exists) {
             # Dump a log message to the development server debug output
@@ -493,7 +493,7 @@ the following method:
             # Return 0 to cancel 'post-auto' processing and prevent use of application
             return 0;
         }
-    
+
         # User found, so return 1 to continue with processing after this 'auto'
         return 1;
     }
@@ -644,7 +644,7 @@ the closing "1;":
             passphrase_class => 'SaltedDigest',
             passphrase_args  => {
                 algorithm   => 'SHA-1',
-                salt_random => 20.
+                salt_random => 20,
             },
             passphrase_check_method => 'check_password',
         },
@@ -671,16 +671,16 @@ file C<set_hashed_passwords.pl> in your editor and enter the following
 text:
 
     #!/usr/bin/perl
-    
+
     use strict;
     use warnings;
-    
+
     use MyApp::Schema;
-    
+
     my $schema = MyApp::Schema->connect('dbi:SQLite:myapp.db');
-    
+
     my @users = $schema->resultset('User')->all;
-    
+
     foreach my $user (@users) {
         $user->password('mypass');
         $user->update;
@@ -742,7 +742,7 @@ change is to the C<password_type> field):
     );
 
 The use of C<self_check> will cause
-Catalyst::Plugin::Authentication::Store::DBIC to call the
+Catalyst::Plugin::Authentication::Store::DBIx::Class to call the
 C<check_password> method we enabled on our C<password> columns.
 
 
@@ -772,21 +772,21 @@ match the following (everything after the model search line of code has
 changed):
 
     =head2 delete
-    
+
     Delete a book
-    
+
     =cut
-    
+
     sub delete :Chained('object') :PathPart('delete') :Args(0) {
         my ($self, $c) = @_;
-    
+
         # Use the book object saved by 'object' and delete it along
         # with related 'book_authors' entries
         $c->stash->{object}->delete;
-    
+
         # Use 'flash' to save information across requests until it's read
         $c->flash->{status_msg} = "Book deleted";
-    
+
         # Redirect the user back to the list page
         $c->response->redirect($c->uri_for($self->action_for('list')));
     }
@@ -807,7 +807,7 @@ flash vs. the C<status_msg> query parameter:
 Although the sample above only shows the C<content> div, leave the rest
 of the file intact -- the only change we made to replace "||
 c.request.params.status_msg" with "c.flash.status_msg" in the
-C<E<lt>span class="message"E<gt>> line.
+C<< <span class="message"> >> line.
 
 
 =head2 Try Out Flash
@@ -833,7 +833,7 @@ we used above.  Consult L<Catalyst::Plugin::Session> for additional
 information.
 
 
-=head2 Switch To Catalyst::Plugin::StatusMessages 
+=head2 Switch To Catalyst::Plugin::StatusMessages
 
 Although the query parameter technique we used in
 L<Chapter 4|Catalyst::Manual::Tutorial::04_BasicCRUD> and the C<flash>
@@ -863,15 +863,15 @@ C<StatusMessage> to the list of plugins:
         -Debug
         ConfigLoader
         Static::Simple
-    
+
         StackTrace
-    
+
         Authentication
-    
+
         Session
         Session::Store::File
         Session::State::Cookie
-    
+
         StatusMessage
     /;
 
@@ -880,14 +880,14 @@ action to match the following:
 
     sub delete :Chained('object') :PathPart('delete') :Args(0) {
         my ($self, $c) = @_;
-    
+
         # Saved the PK id for status_msg below
         my $id = $c->stash->{object}->id;
-    
+
         # Use the book object saved by 'object' and delete it along
         # with related 'book_authors' entries
         $c->stash->{object}->delete;
-    
+
         # Redirect the user back to the list page
         $c->response->redirect($c->uri_for($self->action_for('list'),
             {mid => $c->set_status_msg("Deleted book $id")}));
@@ -909,13 +909,13 @@ match:
 
     sub base :Chained('/') :PathPart('books') :CaptureArgs(0) {
         my ($self, $c) = @_;
-    
+
         # Store the ResultSet in stash so it's available for other methods
         $c->stash(resultset => $c->model('DB::Book'));
-    
+
         # Print a message to the debug log
         $c->log->debug('*** INSIDE BASE METHOD ***');
-    
+
         # Load status messages
         $c->load_status_msgs;
     }
@@ -929,7 +929,7 @@ for C<list> from:
 
 to:
 
-    sub list :Chained('base') :PathParth('list') :Args(0) {
+    sub list :Chained('base') :PathPart('list') :Args(0) {
 
 Finally, let's clean up the status/error message code in our wrapper
 template.  Edit C<root/src/wrapper.tt2> and change the "content" div
@@ -964,11 +964,8 @@ Kennedy Clark, C<hkclark@gmail.com>
 
 Feel free to contact the author for any errors or suggestions, but the
 best way to report issues is via the CPAN RT Bug system at
-<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>.
-
-The most recent version of the Catalyst Tutorial can be found at
-L<http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.80/trunk/lib/Catalyst/Manual/Tutorial/>.
+L<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>.
 
-Copyright 2006-2010, Kennedy Clark, under the
+Copyright 2006-2011, Kennedy Clark, under the
 Creative Commons Attribution Share-Alike License Version 3.0
 (L<http://creativecommons.org/licenses/by-sa/3.0/us/>).