CatalystX::Controller::Auth is a config-driven Catalyst authentication controller base class.
SYNOPSIS
This is a Catalyst controller for handling registering, logging in/out, forgotten/resetting passwords, and changing passwords.
This controller was essentially born out of HTML::FormHandlerX::Form::Login (which it uses), though that form does not want to become dependant on Catalyst.
See CatalystX::SimpleLogin for an alternative approach.
Ensure you include the Catalyst::Plugin::StatusMessage in MyApp.pm.
use Catalyst qw/
...
StatusMessage
...
/;
Extend this base controller class for your own authentication controller, then modify your config as required.
The configs for action_after_register, action_after_login, and action_after_change_password will all need specifying in your own config since they will be specific to your app.
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 >
form_handler HTML::FormHandlerX::Form::Login
view TT
model DB::User
login_id_field email
login_id_db_field email
enable_register 1
enable_sending_register_email 1
register_template auth/register.tt
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 "MyApp"
forgot_password_email_subject Password Reset
forgot_password_email_template_plain reset-password-plain.tt
register_email_view Email::Template
register_email_from "MyApp"
register_email_subject Registration Success
register_email_template_plain register-plain.tt
register_successful_message "You are now registered"
register_exists_failed_message "That username is already registered."
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%^$fghY56VH54& H54&%$uy^5 Y^53U&$u v5ev'
auto_login_after_register 1
action_after_register /admin/index
action_after_login /admin/index
action_after_change_password /admin/index
< /Controller::Auth >
Override actions as necessary (hopefully not too much, otherwise I have not built this right).
All feedback and patches are always welcome.
Product's homepage
Requirements:
· Perl