Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserSession < CGI::Session
- def initialize( request, option = {} )
- # use only when testing, otherwise server log will get huge
- # @debug = true
- @username = option['username']
- super( request, option );
- $stderr << "Using session id '#{self.session_id}' for user '#{self['username']}'\n" unless @debug.nil?
- end
- def create_new_id
- raise 'Missing username for new session' if @username.nil?
- @new_session = true
- return @username
- hash = Digest::MD5.hexdigest("alscore-#{@username}.session")
- @new_session = true
- $stderr << "Created session id '#{hash}' for user '#{@username}'\n" unless @debug.nil?
- hash
- end
- end
Add Comment
Please, Sign In to add comment