Archive of articles classified as' "Bookmarks"

Back home

links for 2011-04-23

23/04/2011
No Comments

links for 2011-04-21

21/04/2011
No Comments

links for 2011-04-16

16/04/2011
  • class Users::SessionsController < Devise::SessionsController                                     
      # Have to reimplement :recall => "failure"  # for warden to redirect to some action that will return what I want  def create       resource = warden.authenticate!(:scope => resource_name, :recall => "failure")    # set_flash_message :notice, :signed_in     sign_in_and_redirect(resource_name, resource)        end    # Example of JSON response  def sign_in_and_redirect(resource_or_scope, resource=nil)    scope      = Devise::Mapping.find_scope!(resource_or_scope)         resource ||= resource_or_scope    sign_in(scope, resource) unless warden.user(scope) == resource    render :json => { :success => true, :redirect  => stored_location_for(scope) || after_sign_in_path_for(resource) }   end              # JSON login failure message                                                     def failure    render :json => {:success => false, :errors => {:reason => "Login failed. Try again"}}   endend
    (tags: devise ajax rails)
No Comments

links for 2011-04-15

15/04/2011
No Comments

links for 2011-04-14

14/04/2011
No Comments

links for 2011-04-12

12/04/2011
No Comments

links for 2011-04-12

12/04/2011
No Comments

links for 2011-04-10

10/04/2011
No Comments