Displaying 5 results from an estimated 5 matches for "forget_me".
2007 Oct 09
4
Camping and sessions proposal.
Hi Campers,
from the discussions gathered around, the current Camping sessions
don''t seem to be satisfying. ActiveRecord doesn''t seem to handle
hashid as an identifier, plus it doesn''t seem to be fully consistent
across the various RDBMS. On the other hand, the scope of the project
does not permit to implement all kind of client persistence. Secure
sessions with
2007 Oct 04
1
Cookies in RSpec
So how do you work with cookies properly in rspec now? I noticed in
the docs that it mentions session, assigns, and flash, but nothing of
cookie. I''m using edge rails so I''m concerned about changes to the
cookie mechanisms. I need to assign values into the cookie (a
remember token for restful authentication) so that I can have it log
in by cookie. here is my spec
2008 Mar 07
0
ActiveRecordStore: cleanup & avoiding duplication
...user.id
if params[:remember_me] == "1"
self.current_user.remember_me
end
current_user.update_attribute(:online, true)
redirect_back_or_default(''/'')
else
render :action => ''new''
end
end
def destroy
self.current_user.forget_me if logged_in?
reset_session
current_user.update_attribute(:online, false)
redirect_back_or_default(''/'')
end
FINDING SESSIONS
@online_sessions = CGI::Session::ActiveRecordStore::Session.find( :all,
:conditions => [ "updated_at > ? and user_id is not null",...
2008 Aug 01
0
Help with Access Control
...pires_at
end
# These create and unset the fields required for remembering users
between browser closes
def remember_me
self.remember_token_expires_at = 2.weeks.from_now.utc
self.remember_token = encrypt("#{email}--
#{remember_token_expires_at}")
save(false)
end
def forget_me
self.remember_token_expires_at = nil
self.remember_token = nil
save(false)
end
private
# before filter
def self.encrypted_password(password, salt)
string_to_hash = "#{password}wibble"+ salt
Digest::SHA1.hexdigest(string_to_hash)
end
de...
2008 Jun 20
15
before_save model callback rspec testing
hi all,
i''m learning rspec and i can''t figure out how to test if a callback is
executed in a model.
my model code is:
class User < ActiveRecord::Base
before_save :encrypt_password
...
def encrypt(password)
self.class.encrypt(password, salt)
end
thanks a lot,
cs.
--
Posted via http://www.ruby-forum.com/.