Class: Adminpanel::SessionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#handle_unverified_request, #signed_in_user

Methods included from SessionsHelper

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

Instance Method Details

#createObject



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

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

#destroyObject



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

def destroy
	sign_out
	redirect_to root_url
end

#newObject



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

def new
end