Sha256: f824760fd89630cffd94016d2b4a78271dc9caa4655eabeeff5e660ba1dc6387

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

require_dependency "brightcontent/application_controller"

module Brightcontent
  class SessionsController < ApplicationController
    skip_before_filter :authorize

    def new
      redirect_to root_url if current_user
    end

    def create
      user = Brightcontent.user_model.find_by_email(params[:email])
      if user && user.authenticate(params[:password])
        session[:brightcontent_user_id] = user.id
        redirect_to root_url
      else
        flash.now[:danger] = "Email or password is invalid"
        render :new
      end
    end

    def destroy
      session[:brightcontent_user_id] = nil
      redirect_to root_url
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brightcontent-core-2.2.0 app/controllers/brightcontent/sessions_controller.rb