diff --git a/lib/login_controller.rb b/lib/login_controller.rb index 9e62309..920a83a 100644 --- a/lib/login_controller.rb +++ b/lib/login_controller.rb @@ -46,6 +46,9 @@ def acts_as_login_controller( options = {} ) if lwt_authentication_system_options[:allow_signup] include LWT::AuthenticationSystem::LoginController::SignupInstanceMethods end + + after_successful_signup do ; end + after_failed_signup do ; end redirect_after_logout do { :action => 'login' } @@ -72,7 +75,7 @@ def restrict_to *privileges, &blk super( *privileges, &blk ) end - + # Sets the arguments to be passed to redirect_to after a user # successfully logs in. The block will be evaluated in the scope # of the controller. @@ -94,6 +97,14 @@ def redirect_after_logout &blk self.lwt_authentication_system_options[:redirect_after_logout] = blk end + def after_successful_signup &blk + self.lwt_authentication_system_options[:after_successful_signup] = blk + end + + def after_failed_signup &blk + self.lwt_authentication_system_options[:after_failed_signup] = blk + end + # Sets the arguments to be passed to redirect_to after a user # successfully signs up. The block will be evaluated in the scope # of the controller. @@ -225,7 +236,10 @@ def signup :from => self.class.lwt_authentication_system_options[:email_from], :subject => self.class.lwt_authentication_system_options[:signup_email_subject] ) flash[:notice] = self.class.lwt_authentication_system_options[:successful_signup_flash] + instance_eval &self.class.lwt_authentication_system_options[:after_successful_signup] redirect_to self.instance_eval( &self.class.lwt_authentication_system_options[:redirect_after_signup] ) + else + instance_eval &self.class.lwt_authentication_system_options[:after_failed_signup] end else flash[:notice] = self.class.lwt_authentication_system_options[:signup_flash]