lib/authgasm/session/config.rb in authgasm-0.9.0 vs lib/authgasm/session/config.rb in authgasm-0.9.1

- old
+ new

@@ -55,11 +55,11 @@ @cookie_separator ||= ":::" end attr_writer :cookie_separator # The name of the cookie or the key in the cookies hash. Be sure and use a unique name. If you have multiple sessions and they use the same cookie it will cause problems. - # Also, if a scope is set it will be inserted into the beginning of the string. Exmaple: + # Also, if a id is set it will be inserted into the beginning of the string. Exmaple: # # session = UserSession.new(:super_high_secret) # session.cookie_key => "super_high_secret_user_credentials" # # * <tt>Default:</tt> "#{klass_name.underscore}_credentials" @@ -82,10 +82,19 @@ def find_by_login_method @find_by_login_method ||= "find_by_#{login_field}" end attr_writer :find_by_login_method + # Calling UserSession.find tries to find the user session by session, then cookie, then basic http auth. This option allows you to change the order or remove any of these. + # + # * <tt>Default:</tt> [:session, :cookie, :http_auth] + # * <tt>Accepts:</tt> Array, and can only use any of the 3 options above + def find_with + @find_with ||= [:session, :cookie, :http_auth] + end + attr_writer :find_with + # The name of the method you want Authgasm to create for storing the login / username. Keep in mind this is just for your Authgasm::Session, if you want it can be something completely different # than the field in your model. So if you wanted people to login with a field called "login" and then find users by email this is compeltely doable. See the find_by_login_method configuration option for # more details. # # * <tt>Default:</tt> Guesses based on the model columns, tries login, username, and email. If none are present it defaults to login @@ -153,11 +162,11 @@ attr_writer :verify_password_method end module InstanceMethods # :nodoc: def cookie_key - key_parts = [scope, self.class.cookie_key].compact + key_parts = [id, self.class.cookie_key].compact key_parts.join("_") end def find_by_login_method self.class.find_by_login_method @@ -178,10 +187,10 @@ def remember_token_field self.class.remember_token_field end def session_key - key_parts = [scope, self.class.session_key].compact + key_parts = [id, self.class.session_key].compact key_parts.join("_") end def verify_password_method self.class.verify_password_method \ No newline at end of file