Displaying 5 results from an estimated 5 matches for "sign_in_and_redirect".
2011 Nov 02
1
getting devise to return json data when signing out
....json {
          if user_signed_in?
            return render :json => {:success => true, :errors =>
["Already logged in."]}
          end
          resource = warden.authenticate!(:scope =>
resource_name, :recall => "#{controller_path}#failure")
          return sign_in_and_redirect(resource_name, resource)
        }
     end
   end
   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
       return re...
2011 Feb 14
0
Devise is causing the [The change you wanted was rejected.] Error...
....
Below is the custom devise controller that I am using.
The custom controller looks like this
  def create
    resource = warden.authenticate!(:scope => resource_name, :recall
=> "oldusercheck") #calling oldusercheck helper function
    set_flash_message(:notice, :signed_in)
    sign_in_and_redirect(resource_name, resource)
  end
  def oldusercheck
    @user = User.find_by_email(params[:user][:email])
    if @user.nil?
      set_flash_message(:alert, :invalid)
      redirect_to :action=>''new''
    else
      if @user.valid_password?(Digest::MD5.hexdigest(params[:user]
[:pa...
2010 Dec 17
1
flash[;notice] not display after redirection
...so iy may not be related to Devise , so
I debugged it ..
.
class Users::RegistrationsController <
Devise::RegistrationsController
..
      # POST /resource/sign_up
  def create
    build_resource
    if resource.save
      if resource.active?
        set_flash_message :notice, :signed_up
        sign_in_and_redirect(resource_name, resource)
      else
        set_flash_message :notice, :inactive_signed_up, :reason =>
resource.inactive_message.to_s
        debugger
        expire_session_data_after_sign_in!
        redirect_to after_inactive_sign_up_path_for(resource)
      end
    else
      clean_up_passwo...
2011 Apr 20
1
Omniauth facebook authentication failure
...cated and application has been
authorised
      authenticate =
Authentication.find_by_provider_and_uid(params[''provider''],
omniauth[''uid''])
      #if user has signed in with that provider before, sign user in and
show the requested page
      if authenticate
    sign_in_and_redirect(:user, authenticate.user)
          flash[:notice] = "Authentication successful!!"
      #create new user
      else
    user = User.new
    user.apply_omniauth(omniauth)
    case omniauth[''provider'']
      when ''facebook''
        if user.save...
2010 Nov 10
0
Devise - Configuring the Routes fine for Controller Inheritance
...t; {:invitations =>
"invitations", :sessions => "sessions"}
This doesn''t work, if I try to sign in I get a template missing error.
How do you configure this for controller inheritance for invitations
and sessions? And make the routes in the controller like
"sign_in_and_redirect(resource_name, resource)" still work?
Thanks
-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this g...