Class: Adminpanel::SessionsController
Instance Method Summary
collapse
#fb_choose_page, #fb_publish, #fb_save_token
#move_better, #move_worst
#edit, #index, #show, #update
#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])
sign_in 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 signin_path
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
|