Sha256: ce222090e8882e21e41e3fc1d246763abdc58c7271a5715989873ba399a2ce4c

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

Stored size: 719 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.2 app/controllers/adminpanel/sessions_controller.rb
adminpanel-2.1.1 app/controllers/adminpanel/sessions_controller.rb
adminpanel-2.1.0 app/controllers/adminpanel/sessions_controller.rb
adminpanel-2.0.1 app/controllers/adminpanel/sessions_controller.rb