Class: Adminpanel::SessionsController

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

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object



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

#destroy ⇒ Object



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

def destroy
	sign_out
	redirect_to 
end

#new ⇒ Object



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

def new
end