Sha256: 1921fc91e6e05a3d99a53b2dd36d22f4f3eb08c09531326017892aabeb0c4791

Contents?: true

Size: 841 Bytes

Versions: 2

Compression:

Stored size: 841 Bytes

Contents

# encoding: utf-8
class SessionsController < ApplicationController
  def new
    @title= 'Sign In'
  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
    refresh_to root_path
  rescue
    redirect_to root_path, :alert=> "Authentication failed, please try again."
  end

  def destroy
    session[:user_id] = nil
    # redirect_to '/mindapp/help'
    refresh_to root_path
    #  render not work!!
    #redirect_to 'mindapp/index'
  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

2 entries across 2 versions & 1 rubygems

Version Path
mindapp2-0.1.1.5 lib/generators/mindapp/templates/app/controllers/sessions_controller.rb
mindapp2-0.1.1.4 lib/generators/mindapp/templates/app/controllers/sessions_controller.rb