Sha256: 7a9f846000e6986c1936fae633601feefda095b995da7594d9403716ce03dc07

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

require_dependency "as_user/application_controller"

module AsUser
  class SessionsController < ApplicationController
    def new
      if signed_in? then
        redirect_to current_user
      end
    end

    def create
      user = User.find_by_email params[:session][:email].downcase
      if user && user.authenticate(params[:session][:password])
        sign_in user
        redirect_back_or user
      else
        flash.now[:error] = "Invalid email/password combination"
        render 'new'
      end
    end

    def destroy
      sign_out
      redirect_to root_path, notice: "signed out."
    end
  
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
as_user-0.0.3 app/controllers/as_user/sessions_controller.rb