Sha256: 74ab4c54ca8020c2b870034d68cb960d19b59858ac451f2bc031e5be0255b585

Contents?: true

Size: 559 Bytes

Versions: 3

Compression:

Stored size: 559 Bytes

Contents

module Brightcontent
  class SessionsController < ApplicationController
    skip_before_filter :authorize

    def new
    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

3 entries across 3 versions & 1 rubygems

Version Path
brightcontent-core-2.1.3 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.1.2 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.1.1 app/controllers/brightcontent/sessions_controller.rb