Sha256: 23d652d54bcbefa39c341b20e450d6249d80447f52858197c273c76f18b8b124

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

module Clearance
  module App
    module Controllers
      module UsersController

        def self.included(controller)
          controller.send(:include, Actions)
          controller.send(:include, PrivateMethods)

          controller.class_eval do
            before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in?
            filter_parameter_logging :password
          end
        end

        module Actions
          def new
            @user = User.new(params[:user])
          end

          def create
            @user = User.new params[:user]
            if @user.save
              ClearanceMailer.deliver_confirmation @user
              flash[:notice] = "You will receive an email within the next few minutes. " <<
                               "It contains instructions for confirming your account."
              redirect_to url_after_create
            else
              render :action => "new"
            end
          end
        end

        module PrivateMethods
          private

          def url_after_create
            new_session_url
          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
jeffrafter-clearance-0.5.4 lib/clearance/app/controllers/users_controller.rb
kellyfelkins-clearance-0.5.6 lib/clearance/app/controllers/users_controller.rb
thoughtbot-clearance-0.5.3 lib/clearance/app/controllers/users_controller.rb
thoughtbot-clearance-0.5.4 lib/clearance/app/controllers/users_controller.rb
thoughtbot-clearance-0.5.6 lib/clearance/app/controllers/users_controller.rb