Sha256: 32044a4ea2507be600cafcdd28a0c2babc30be8772f443a58dcf348c898136e6

Contents?: true

Size: 835 Bytes

Versions: 4

Compression:

Stored size: 835 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
    user = User.from_omniauth(request.env["omniauth.auth"])
    session[:user_id] = user.id
    redirect_to '/mindapp/pending'
  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

4 entries across 4 versions & 1 rubygems

Version Path
mindapp2-0.1.1.3 lib/generators/mindapp/templates/app/controllers/sessions_controller.rb
mindapp2-0.1.1.2 lib/generators/mindapp/templates/app/controllers/sessions_controller.rb
mindapp2-0.1.1.1 lib/generators/mindapp/templates/app/controllers/sessions_controller.rb
mindapp2-0.1.0 lib/generators/mindapp/templates/app/controllers/sessions_controller.rb