Sha256: 7815589bd9e5f1af30bfa4a3287263e6f6cef0683ace3faff32c2d151f53b5b4

Contents?: true

Size: 1.24 KB

Versions: 28

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8
class SessionsController < ApplicationController
  def new
    @title= 'Sign In'
  end

  def failure
    redirect_to login_path, alert: "Authentication failed, please try again."
  end

  # to refresh the page, must know BEFOREHAND that the action needs refresh
  # then use attribute 'data-ajax'=>'false'
  # see app/views/sessions/new.html.erb for sample
  def create
    auth = request.env["omniauth.auth"]
    user = User.from_omniauth(auth)
    session[:user_id] = user.id
    if params.permit[:remember_me]
      cookies.permanent[:auth_token] = user.auth_token
    else
      cookies[:auth_token] = user.auth_token
    end
    # refresh_to root_path, :ma_notice => "Logged in" # Called by jinda_conroller
    # redirect_to root_path
		redirect_to articles_my_path

  rescue
    redirect_to root_path, :alert=> "Authentication failed, please try again."
  end

  def destroy
    session[:user_id] = nil
    cookies.delete(:auth_token)
    refresh_to root_path, :ma_notice => "Logged Out" # called by jinda_controller, not pass tested
    # redirect_to root_path # Ok with test

  end

  def failure
    ma_log "Authentication failed, please try again."
    redirect_to root_path, :alert=> "Authentication failed, please try again."
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
jinda-0.7.0.1 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.7.0 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.9 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.8 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.7 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.5 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.4 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.3 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.2 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.1 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.6.0 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.9 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.8 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.7 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.6 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.5 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.4 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.3 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.2 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb
jinda-0.5.1 lib/generators/jinda/templates/app/controllers/jinda_org/sessions_controller.rb