Class: Adminpanel::SessionsController
Instance Method Summary
collapse
#handle_unverified_request, #signed_in_user
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#create ⇒ Object
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])
sign_in user
flash[:success] = "Bienvenido!"
redirect_to root_url
else
flash.now[:error] = "Password Incorrecto"
render 'new'
end
end
|
#destroy ⇒ Object
21
22
23
24
|
# File 'app/controllers/adminpanel/sessions_controller.rb', line 21
def destroy
sign_out
redirect_to root_url
end
|
#new ⇒ Object
6
7
|
# File 'app/controllers/adminpanel/sessions_controller.rb', line 6
def new
end
|