Class: SessionController

Inherits:
BaseController show all
Defined in:
app/controllers/session_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#section, #site

Instance Method Summary collapse

Methods included from Adva::AuthenticateUser

#authenticate_user, #authenticated?, #current_user, included

Methods included from ResourceHelper

#current_controller_namespace, #links_to_actions, #normalize_resource_link_options, #normalize_resource_link_text, #normalize_resource_type, #resource_delete_options, #resource_link, #resource_link_id, #resource_owners, #resource_url, #resource_url_method, #resource_url_namespace

Methods included from ContentHelper

#content_category_checkbox, #content_path, #content_status, #link_to_category, #link_to_content, #link_to_preview, #link_to_tag, #links_to_content_categories, #links_to_content_tags, #page_link_path, #published_at_formatted

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/session_controller.rb', line 12

def create
  if authenticate_user(params[:user])
    remember_me! if params[:user][:remember_me]
    redirect_to return_from(:login), notice: "Logged in successfully."
  else
    @user = User.new(:email => params[:user][:email])
    @remember_me = params[:user][:remember_me]
    flash.now.alert = "Could not login with this email and password."
    render :action => 'new'
  end
end

#destroyObject



24
25
26
27
# File 'app/controllers/session_controller.rb', line 24

def destroy
  logout
  redirect_to return_from(:logout), notice: "Logged out successfully."
end

#newObject



8
9
10
# File 'app/controllers/session_controller.rb', line 8

def new
  @user = User.new
end