lib/janus/controllers/confirmations_controller.rb in janus-0.8.1 vs lib/janus/controllers/confirmations_controller.rb in janus-0.9.0

- old
+ new

@@ -10,12 +10,16 @@ if resource resource.confirm! respond_to do |format| - format.html { redirect_to root_url, :notice => t('flash.janus.confirmations.edit.confirmed') } - format.any { head :ok } + format.html do + redirect_to after_confirmation_url(resource), + :notice => t('flash.janus.confirmations.edit.confirmed') + end + + format.any { head :ok } end else respond_to do |format| format.html do self.resource = resource_class.new @@ -35,14 +39,18 @@ def create self.resource = resource_class.find_for_database_authentication(params[resource_name]) if resource - deliver_confirmation_instructions + deliver_confirmation_instructions(resource) respond_to do |format| - format.html { redirect_to root_url, :notice => t('flash.janus.confirmations.create.email_sent') } + format.html do + redirect_to after_resending_confirmation_instructions_url(resource), + :notice => t('flash.janus.confirmations.create.email_sent') + end + format.any { head :ok } end else respond_to do |format| format.html do @@ -56,9 +64,19 @@ end end # Simple wrapper for Mailer#confirmation_instructions.deliver to # allow customization of the email (eg: to pass additional data). - def deliver_confirmation_instructions + def deliver_confirmation_instructions(resource) mailer_class.confirmation_instructions(resource).deliver + end + + # Where to redirect after the instructions have been sent. + def after_resending_confirmation_instructions_url(resource) + root_url + end + + # Where to redirect when the user has confirmed her account. + def after_confirmation_url(resource) + root_url end end