public
Description: Spree is a complete open source e-commerce solution for Ruby on Rails.
Home | Edit | New

Customization

Users

Disabling Auto Login on User Create

Currently, when a new user is created through the front end of the system, they are automatically logged in. If you decide to add some sort of authentication process that requires a user to request approval before they can use the system, having the system autolog them in when they create a new user may be problematic. If you want to disable autologin, the key is in /app/models/user.rb . The best way to change this would be opening up a current instance of the spree project and copying the entire contents of this file from that project. Then open up your current project and open up an extension in /vendor/extension (site is the default). Create the app and models folders within your extension folder and then create the user.rb file inside there, pasting the original spree user.rb in full. Now find the part of the code that says:

acts_as_authentic do |c|
c.transition_from_restful_authentication = true
#AuthLogic defaults

and add in c.maintain_sessions = false as shown below

acts_as_authentic do |c|
c.transition_from_restful_authentication = true
c.maintain_sessions = false
#AuthLogic defaults

lots of other user mods can be made here as well concerning the AuthLogic plugin spree uses for users and user sessions. For more info, consult the AuthLogic readme at http://github.com/binarylogic/authlogic/tree/master or documentation at http://rdoc.info/projects/binarylogic/authlogic .

Last edited by wharle90, Thu Aug 20 08:40:19 -0700 2009
Home | Edit | New
Versions: