Class: Adminpanel::SessionsController

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

Instance Method Summary collapse

Methods included from FacebookActions

#fb_choose_page, #fb_publish, #fb_save_token

Methods included from GalleryzableActions

#move_better, #move_worst

Methods included from RestActions

#edit, #index, #show, #update

Methods included from SessionsHelper

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

Instance Method Details

#create ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/adminpanel/sessions_controller.rb', line 14

def create
  user = User.find_by_email(params[:session][:email].downcase)
  if user && user.authenticate(params[:session][:password])
       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

#destroy ⇒ Object



26
27
28
29
# File 'app/controllers/adminpanel/sessions_controller.rb', line 26

def destroy
  sign_out
  redirect_to 
end

#new ⇒ Object



7
8
9
10
11
12
# File 'app/controllers/adminpanel/sessions_controller.rb', line 7

def new
  respond_to do |format|
    format.html
    format.json { render :json => {:session => @session }}
  end
end