Class: Adminpanel::SessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/adminpanel/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#get_menu_elements, #handle_unverified_request, #set_model, #signed_in_user

Methods included from RouterHelper

#adminpanel_resources, #default_controllers, #find_resources, #menu_items, #resources_path

Methods included from RestActionsHelper

#edit, #index, #show, #update

Methods included from SessionsHelper

#current_user, #current_user=, #sign_in, #sign_out, #signed_in?

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/adminpanel/sessions_controller.rb', line 10

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

#destroyObject



22
23
24
25
# File 'app/controllers/adminpanel/sessions_controller.rb', line 22

def destroy
	sign_out
	redirect_to 
end

#newObject



7
8
# File 'app/controllers/adminpanel/sessions_controller.rb', line 7

def new
end