Sha256: fc4e99a537e2182cd5b1160e7918313a5f504f3bb919739c37818cb77c163d30

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

require_dependency "brightcontent/application_controller"

module Brightcontent
  class SessionsController < ApplicationController
    skip_before_action :authorize

    def new
      redirect_to root_url if current_user
    end

    def create
      user = Brightcontent.user_model.authenticate(params[:email], params[:password])
      if user
        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

6 entries across 6 versions & 1 rubygems

Version Path
brightcontent-core-2.5.1 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.5.0 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.4.6 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.4.5 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.4.4 app/controllers/brightcontent/sessions_controller.rb
brightcontent-core-2.4.3 app/controllers/brightcontent/sessions_controller.rb