Sha256: 1bf2007a10b40f296c02f91df7aea8c320168d54defb6c54b6751bef6882902e

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

Contents

module Adminpanel
  class SessionsController < Adminpanel::ApplicationController
    skip_authorization_check
    layout 'admin-login'
    skip_before_filter :signed_in_user, :set_model

    def new
      respond_to do |format|
        format.html
        format.json { render :json => {:session => @session }}
      end
    end

    def create
      user = User.find_by_email(params[:session][:email].downcase)
      if user && user.authenticate(params[:session][:password])
          sign_in user
          flash[:success] = I18n.t("authentication.signin_success")
          redirect_to root_url
      else
        flash.now[:error] = I18n.t("authentication.signin_error")
        render 'new'
      end
    end

    def destroy
      sign_out
      redirect_to signin_path
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-2.1.7 app/controllers/adminpanel/sessions_controller.rb
adminpanel-2.1.6 app/controllers/adminpanel/sessions_controller.rb
adminpanel-2.1.5 app/controllers/adminpanel/sessions_controller.rb
adminpanel-2.1.3 app/controllers/adminpanel/sessions_controller.rb