module Devise::Controllers::Helpers
def sign_in(resource_or_scope, *args)
sign_in @user, :bypass => true # sign_in(resource, options)
sign_in @user, :event => :authentication # sign_in(resource, options)
sign_in @user # sign_in(resource)
sign_in :user, @user # sign_in(scope, resource)
Examples:
signed in, but we want to refresh the credentials in session.
the user straight in session. This option is useful in cases the user is already
The only exception is the :bypass option, which bypass warden callbacks and stores
All options given to sign_in is passed forward to the set_user method in warden.
users in after sign up.
Sign in a user that already was authenticated. This helper is useful for logging
def sign_in(resource_or_scope, *args) options = args.extract_options! scope = Devise::Mapping.find_scope!(resource_or_scope) resource = args.last || resource_or_scope expire_session_data_after_sign_in! if options[:bypass] warden.session_serializer.store(resource, scope) elsif warden.user(scope) == resource && !options.delete(:force) # Do nothing. User already signed in and we are not forcing it. true else warden.set_user(resource, options.merge!(:scope => scope)) end end