Class: Kryptonite::UserSessionsController

Inherits:
KryptoniteController show all
Defined in:
app/controllers/kryptonite/user_sessions_controller.rb

Instance Method Summary collapse

Methods inherited from KryptoniteController

#blank, #index

Methods included from ConfigHelper

#kryptonite_config_dashboard_url, #kryptonite_config_email_from_address, #kryptonite_config_hostname, #kryptonite_config_javascript_includes, #kryptonite_config_logo, #kryptonite_config_stylesheet_includes, #kryptonite_config_website_name

Methods included from KryptoniteHelper

#kryptonite_assets_field, #kryptonite_check_box, #kryptonite_check_box_group, #kryptonite_collection_select, #kryptonite_date_select, #kryptonite_datetime_select, #kryptonite_file_field, #kryptonite_generate_page_title, #kryptonite_get_access_level_array, #kryptonite_get_access_level_text, #kryptonite_get_full_version_string, #kryptonite_get_language_array, #kryptonite_get_short_version_string, #kryptonite_get_version_info, #kryptonite_hidden_field, #kryptonite_password_field, #kryptonite_radio_button, #kryptonite_radio_button_group, #kryptonite_select, #kryptonite_show_icon, #kryptonite_show_row_icon, #kryptonite_table_cell_link, #kryptonite_table_cell_no_link, #kryptonite_text_area, #kryptonite_text_area_big, #kryptonite_text_field, #kryptonite_time_select, #kryptonite_time_zone_select

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/kryptonite/user_sessions_controller.rb', line 15

def create
  @user_session = Kryptonite::UserSession.new params[:kryptonite_user_session]
  if @user_session.save
    flash[:notice] = t(:login_successful)
    if !params[:frontend].blank?
      redirect_to(params[:frontend])
    else
      redirect_back_or_default :controller => :kryptonite, :action => :index
    end
  else
    render :action => :new
  end
end

#destroyObject



29
30
31
32
33
34
35
36
37
# File 'app/controllers/kryptonite/user_sessions_controller.rb', line 29

def destroy
  current_user_session.destroy
  flash[:notice] = t(:logout_successful)
  if !params[:frontend].blank?
    redirect_to(params[:frontend])
  else
    redirect_back_or_default new_kryptonite_user_session_url
  end
end

#newObject



11
12
13
# File 'app/controllers/kryptonite/user_sessions_controller.rb', line 11

def new
  @user_session = Kryptonite::UserSession.new
end