NAME
CatalystX::Controller::Auth - A config-driven Catalyst authentication controller base class.
VERSION
Version 0.07
SYNOPSIS
This is a Catalyst controller for dealing with all instances of logging in, forgotten password, changing passwords, etc.
You simply extend it for your own authentication controller, then modify your config as required.
Overriding the actions should not be necessary, unless you want to get your hands dirty and really change the logic.
package MyApp::Controller::Auth;
use Moose;
use namespace::autoclean;
BEGIN { extends 'CatalystX::Controller::Auth'; }
__PACKAGE__->meta->make_immutable;
1;
Configure it as you like ...
<Controller::Auth>
view TT
model DB::User
login_id_field email
login_id_db_field email
login_template auth/login.tt
change_password_template auth/change-password.tt
forgot_password_template auth/forgot-password.tt
reset_password_template auth/reset-password.tt
forgot_password_email_view Email::Template
forgot_password_email_from "Password Reset" <nobody@example.com>
forgot_password_email_subject Password Reset
forgot_password_email_template_plain reset-password-plain.tt
login_required_message "You need to login."
already_logged_in_message "You are already logged in."
login_successful_message "Logged in!"
logout_successful_message "You have been logged out successfully."
login_failed_message "Bad username or password."
password_changed_message "Password changed."
password_reset_message "Password reset successfully."
forgot_password_id_unknown "Email address not registered."
token_salt 'tgve546vy6yv%^$Ycv36CW46Y56VH54& H54&%$uy^5 Y^53U&$u v5ev'
action_after_login /admin/index
action_after_change_password /admin/index
</Controller::Auth>
CHAINS
base ( mid-point: / )
sub base :Chained('/base') :PathPart('') :CaptureArgs(0)
authenticated ( mid-point: / )
Chain off this action to make sure people are logged in.
sub authenticated :Chained('base') :PathPart('') :CaptureArgs(0)
login ( end-point: /login )
Login, redirect if already logged in.
sub login :Chained('base') :PathPart :Args(0)
logout ( end-point: /logout )
Logs out, and redirects back to /login.
sub logout :Chained('base') :PathPart :Args(0)
forgot_password ( end-point: /forgot-password/ )
Send a forgotten password toekn to reset it.
sub forgot_password :Chained('base') :PathPart('forgot-password') :Args(0)
reset_password ( end-point: /reset-password/ )
Reset password using a token sent in an username.
sub reset_password :Chained('base') :PathPart('reset-password') :Args(0)
get ( mid-point: /auth/*/ )
Gets a user and puts them in the stash.
sub get :Chained('base') :PathPart('auth') :CaptureArgs(1)
change_password ( end-point: /auth/*/change-password/ )
Change your password.
sub change_password :Chained('get') :PathPart('change-password') :Args(0)
AUTHOR
Rob Brown, <rob at intelcompute.com>
BUGS
Please report any bugs or feature requests to bug-catalystx-controller-auth at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-Controller-Auth. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc CatalystX::Controller::Auth
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=CatalystX-Controller-Auth
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
t0m: Tomas Doran <bobtfish@bobtfish.net>
LICENSE AND COPYRIGHT
Copyright 2012 Rob Brown.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.