[Jifty-commit] r3581 - in jifty/trunk: lib/Jifty/Plugin/Authentication lib/Jifty/Plugin/Authentication/Password lib/Jifty/Plugin/Authentication/Password/Mixin/Model

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Jun 27 21:43:54 EDT 2007


Author: sterling
Date: Wed Jun 27 21:43:53 2007
New Revision: 3581

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/Authentication/Password.pm
   jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
   jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
   jifty/trunk/lib/Jifty/Plugin/Authentication/Password/View.pm

Log:
 r7875 at dynpc145:  andrew | 2007-06-27 20:43:00 -0500
 Fleshing out and cleaning up the documentation for Jifty::Plugin::Authentication::Password.


Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/Password.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/Password.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/Password.pm	Wed Jun 27 21:43:53 2007
@@ -4,23 +4,17 @@
 package Jifty::Plugin::Authentication::Password;
 use base qw/Jifty::Plugin/;
 
-# Your plugin goes here.  If takes any configuration or arguments, you
-# probably want to override L<Jifty::Plugin/init>.
-
 =head1 NAME
 
-Jifty::Plugin::Authentication::Password
+Jifty::Plugin::Authentication::Password - password authentication plugin
 
 =head1 DESCRIPTION
 
-When finished, this plugin will provide password authentication for 
-your Jifty application. (It adds a "password" column to your "User" model class).
-
-Right now, it's useless and should be ignored.
+B<CAUTION:> This plugin is experimental.
 
+This may be combined with the L<Jifty::Plugin::User> and L<Jifty::Plugin::LetMe> plugins to provide user accounts and form-based password authentication to your application.
 
-=cut
-
+=head2 METHODS
 
 =head2 prereq_plugins
 
@@ -33,4 +27,15 @@
     return ('User', 'LetMe');
 }
 
+=head1 SEE ALSO
+
+L<Jifty::Plugin::User>, L<Jifty::Plugin::LetMe>, L<Jifty::Plugin::Authentication::Password::Mixin::Model::User>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
+
 1;

Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm	Wed Jun 27 21:43:53 2007
@@ -4,25 +4,22 @@
 package Jifty::Plugin::Authentication::Password::Dispatcher;
 use Jifty::Dispatcher -base;
 
-# Put any plugin-specific dispatcher rules here.
-
-
 =head1 NAME
 
-Jifty::Plugin::Authentication::Password::Dispatcher
+Jifty::Plugin::Authentication::Password::Dispatcher - password plugin dispatcher
 
 =head1 DESCRIPTION
 
 All the dispatcher rules jifty needs to support L<Jifty::Authentication::Password/>
 
-=cut
-
-
 =head1 RULES
 
-
 =head2 before logout
 
+Logout and return home.
+
+See L<Jifty::Plugin::Authentication::Password::Action::Logout>.
+
 =cut
 
 before 'logout' => run {
@@ -35,6 +32,8 @@
 
 =head2 before *
 
+Setup the navigation menu for login or logout.
+
 =cut
 
 before '*' =>  run {
@@ -47,7 +46,11 @@
 
 };
 
-=head2 on qr/^(?:passwordreminder|signup)$/ 
+=head2 on qr/^(?:passwordreminder|signup|lost_password)$/ 
+
+Redirect to home if logged.
+
+Request a password reminder or signup for an account otherwise.
 
 =cut
 
@@ -58,6 +61,10 @@
 
 =head2 on login
 
+Redirect to home if logged.
+
+Show the login form otherwise.
+
 =cut
 
 before qr|^/(?:login)$| => run {
@@ -65,12 +72,22 @@
     set 'next' => Jifty->web->request->continuation || Jifty::Continuation->new( request => Jifty::Request->new( path => "/" ) );
 };
 
+=head2 before reset_lost_password
+
+Request a password reset.
+
+=cut
+
 before qr|(?:reset_lost_password)| => run {
     set 'next' => Jifty->web->request->continuation || Jifty::Continuation->new( request => Jifty::Request->new( path => "/" ) );
 };
 # Send a password reminder for a lost password
 
-=head2 on passwordreminder
+=head2 before passwordreminder
+
+Request a new password reminder to be sent by email.
+
+See L<Jifty::Plugin::Authentication::Password::Action::SendPasswordReminder>.
 
 =cut
 
@@ -79,9 +96,11 @@
 };
 
 
-=head2 on signup
+=head2 before signup
+
+Sign up for an account.
 
-# Sign up for an account
+See L<Jifty::Plugin::Authentication::Password::Action::Signup>.
 
 =cut
 
@@ -90,9 +109,11 @@
 
 };
 
-=head2 on login
+=head2 before login
 
-Login
+Login to your account.
+
+See L<Jifty::Plugin::Authentication::Password::Action::Login>.
 
 =cut
 
@@ -102,6 +123,8 @@
 
 =head2 not_logged_in_nav
 
+Adds the login and signup links to the navigation menu.
+
 =cut
 
 sub not_logged_in_nav {
@@ -119,6 +142,8 @@
 
 =head2 logged_in_nav
 
+Adds the logout link to the navigation menu.
+
 =cut
 
 sub logged_in_nav {
@@ -130,5 +155,14 @@
 
 }
 
+=head1 SEE ALSO
+
+L<Jifty::Plugin::Authentication::Password>, L<Jifty::Plugin::Authentication::Password::View>
+
+=head1 COPYRIGHT
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
 
 1;

Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm	Wed Jun 27 21:43:53 2007
@@ -9,6 +9,40 @@
 
 our @EXPORT = qw(password_is hashed_password_is regenerate_auth_token has_alternative_auth);
 
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Mixin::Model::User - password plugin user mixin model
+
+=head1 SYNOPSIS
+
+  package MyApp::Model::User;
+  use Jifty::DBI::Schema;
+  use MyApp::Record schema {
+      # custom column defrinitions
+  };
+
+  use Jifty::Plugin::User::Mixin::Model::User; # name, email, email_confirmed
+  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
+  # ^^ password, auth_token
+
+=head1 DESCRIPTION
+
+This mixin model is added to the application's account model for use with the password authentication plugin. This mixin should be used in combination with L<Jifty::Plugin::User::Mixin::Model::User>.
+
+=head1 SCHEMA
+
+This mixin adds the following columns to the model schema:
+
+=head2 auth_token
+
+This is a unique identifier used when confirming a user's email account and recovering a lost password.
+
+=head2 password
+
+This is the user's password. It will be stored in the database after being processed through L<Digest::MD5>, so the password cannot be directly recovered from the database.
+
+=cut
+
 use Jifty::Plugin::Authentication::Password::Record schema {
 
 
@@ -31,6 +65,14 @@
 
 };
 
+=head1 METHODS
+
+=head2 register_triggers
+
+Adds the triggers to the model this mixin is added to.
+
+=cut
+
 sub register_triggers {
     my $self = shift;
     $self->add_trigger(name => 'after_create', callback => \&after_create);
@@ -60,7 +102,9 @@
 =head2 hashed_password_is HASH TOKEN
 
 Check if the given I<HASH> is the result of hashing our (already
-salted and hashed) password with I<TOKEN>
+salted and hashed) password with I<TOKEN>.
+
+This can be used in cases where the pre-hashed password is sent during login as an additional security precaution (such as could be done via Javascript).
 
 =cut
 
@@ -93,6 +137,14 @@
     return 1;
 }
 
+=head2 after_create
+
+This trigger is added to the account model. It automatically sends a notification email to the user for password confirmation.
+
+See L<Jifty::Plugin::Authentication::Password::Notification::ConfirmEmail>.
+
+=cut
+
 
 sub after_create {
     my $self = shift;
@@ -143,7 +195,16 @@
     $self->__set(column => 'auth_token', value => $auth_token);
 }
 
+=head1 SEE ALSO
+
+L<Jifty::Plugin::Authentication::Password>, L<Jifty::Plugin::User::Mixin::Model>
 
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
 
 1;
 

Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/Password/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/Password/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/Password/View.pm	Wed Jun 27 21:43:53 2007
@@ -4,12 +4,19 @@
 
 =head1 NAME
 
-Jifty::Plugin::Authentication::Password::Login::View
+Jifty::Plugin::Authentication::Password::View - views for password plugin
 
 =head1 DESCRIPTION
 
-This code is only useful on the new Jifty "Declarative templates" branch. It shouldn't get in the way 
-if you're running a traditional (0.610 or before) Jifty.
+This code is only useful on the new Jifty "Declarative templates" branch. It shouldn't get in the way if you're running a traditional (0.610 or before) Jifty.
+
+=begin comment
+
+Is the above really true or need to said anymore? -- Sterling
+
+=end
+
+This provides the templates for the pages and forms used by the password authentication plugin.
 
 =cut
 
@@ -24,6 +31,13 @@
 }
 }
 
+=head1 TEMPLATES
+
+=head2 signup
+
+Displays a sign-up form.
+
+=cut
 
 template 'signup' => page { title => _('Sign up') } content {
     my ( $action, $next ) = get(qw(action next));
@@ -34,10 +48,26 @@
     Jifty->web->form->end();
 };
 
+=head2 login
+
+Displays the login form.
+
+=cut
+
 template login => page { title => _('Login!') } content {
     show('login_widget');
 };
 
+=head2 login_widget
+
+A handy template for embedding the login form. Just include it in your templates via:
+
+  show('login_widget');
+
+See L<Jifty::Plugin::Authentication::Password::Action::Login>.
+
+=cut
+
 template login_widget => sub {
 
     my ( $action, $next ) = get( 'action', 'next' );
@@ -67,6 +97,14 @@
     }
 };
 
+=head2 let/reset_lost_password
+
+After requesting a password reset and clicking on the link sent by email, this receives that click and provides the form for resetting the password.
+
+See L<Jifty::Plugin::Authentication::Action::ResetLostPassword>.
+
+=cut
+
 template 'let/reset_lost_password' => page { title => 'Reset lost password' } content {
     my ( $next ) = get(qw(next));
     my $action = Jifty->web->new_action( class => 'ResetLostPassword' );
@@ -77,11 +115,27 @@
     Jifty->web->form->end();
 };
 
+=head2 let/confirm_email
+
+Handles the work of confirming an email address for a new account.
+
+See L<Jifty::Plugin::Authenticaiton::Password::View>.
+
+=cut
+
 template 'let/confirm_email' => sub {
     new_action( class => 'ConfirmEmail' )->run;
     redirect("/");
 };
 
+=head2 lost_password
+
+Starts the process of sending a link to reset a lost password by email.
+
+See L<Jifty::Plugin::Authentication::Password::SendPasswordReminder>.
+
+=cut
+
 template 'lost_password' => page { title => 'Send a link to reset your password' } content {
     my ( $next ) = get(qw(next));
     my $action = Jifty->web->new_action(
@@ -98,6 +152,20 @@
 
 };
 
+=head2 passwordreminder
+
+Starts the process of sending a link to reset a lost password by email.
+
+See L<Jifty::Plugin::Authentication::Password::SendPasswordReminder>.
+
+=begin comment
+
+What's the difference between lost_password and passwordreminder? -- Sterling
+
+=end
+
+=cut
+
 template 'passwordreminder' => page { title => 'Send a password reminder' } content {
     my $next = get('next');
     my $action = Jifty->web->new_action(
@@ -113,6 +181,14 @@
     Jifty->web->form->end();
 };
 
+=head2 resend_confirmation
+
+Request a new email confirmation message be sent to your email account.
+
+See L<Jifty::Plugin::Authentication::Password::Action::ResendConfirmation>.
+
+=cut
+
 template 'resend_confirmation' => page { title => 'Resend Confirmation Email' } content {
     my $resend = Jifty->web->new_action(
         class   => 'ResendConfirmation',
@@ -141,6 +217,16 @@
     }
 };
 
+=head1 SEE ALSO
+
+L<Jifty::Plugin::Authentication::Password>, L<Jifty::Plugin::Authentication::Password::Dispatcher>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
 
 
 1;


More information about the Jifty-commit mailing list