class SessionsController

Public Instance Methods

create() click to toggle source

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

# File lib/generators/mindapp/templates/app/controllers/sessions_controller.rb, line 10
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
destroy() click to toggle source
# File lib/generators/mindapp/templates/app/controllers/sessions_controller.rb, line 19
def destroy
  session[:user_id] = nil
  # redirect_to '/mindapp/help'
  refresh_to root_path
  #  render not work!!
  #redirect_to 'mindapp/index'
end
failure() click to toggle source
# File lib/generators/mindapp/templates/app/controllers/sessions_controller.rb, line 27
def failure
  ma_log "Authentication failed, please try again."
  redirect_to root_path, :alert=> "Authentication failed, please try again."
end
new() click to toggle source
# File lib/generators/mindapp/templates/app/controllers/sessions_controller.rb, line 3
def new
  @title= 'Sign In'
end