Sha256: faa2e6b0ef078e86f15cc2c19006344a99b12010e4ff856f9a2ecc69d6283948

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

module Clearance
  module App
    module Controllers
      module UsersController

        def self.included(base)
          base.class_eval do
            before_filter :redirect_to_root, :only => [:new, :create], :if => :logged_in?
        
            filter_parameter_logging :password
        
            include InstanceMethods
        
          private
            include PrivateInstanceMethods
          end
        end

        module InstanceMethods
          def new
            @user = user_model.new(params[:user])
          end
      
          def create
            @user = user_model.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 you to confirm your account."
              redirect_to url_after_create
            else
              render :action => "new"
            end
          end
        end

        module PrivateInstanceMethods

          def url_after_create
            new_session_url
          end
        
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
gravis-clearance-0.3.7 lib/clearance/app/controllers/users_controller.rb
mischa-clearance-0.3.3 lib/clearance/app/controllers/users_controller.rb
mischa-mischa-clearance-0.3.3 lib/clearance/app/controllers/users_controller.rb
thoughtbot-clearance-0.3.4 lib/clearance/app/controllers/users_controller.rb
thoughtbot-clearance-0.3.7 lib/clearance/app/controllers/users_controller.rb