search for: create_new_salt

Displaying 4 results from an estimated 4 matches for "create_new_salt".

2006 Jul 06
1
Problem implementing password and password confirmation
...hed_password, :string t.column :salt, :string User model has: =============== attr_accessor :password_confirmation validates_confirmation_of :password # ''password'' is a virtual attribute def password @password end def password=(pwd) @password = pwd create_new_salt self.hashed_password = User.encrypted_password(self.password, self.salt) end Controller ========== def create @user = User.new(params[:user]) if @user.save flash[:notice] = "User #{@user.name} was successfully created." redirect_to :action => ''ne...
2008 Aug 01
0
Help with Access Control
...= find_by_username(username) # need to get the salt if login expected_password = encrypted_password(crypted_password, login.salt) if login.crypted_password != expected_password login = nil end end login end def password @password end def password=(pw) @password = pw create_new_salt self.crypted_password = User.encrypted_password(self.password, self.salt) end def remember_token? remember_token_expires_at && Time.now.utc < remember_token_expires_at end # These create and unset the fields required for remembering users between browser closes def remembe...
2010 Apr 26
2
woriking under webrick but not under passenger
...expected_password = encrypted_password(password, user.salt) if user.hashed_password != expected_password user = nil end end user end # ''password'' is a virtual attribute def password @password end def password=(pwd) @password = pwd create_new_salt self.hashed_password = User.encrypted_password(self.password, self.salt) end def after_destroy if User.count.zero? raise "Can''t delete last user" end end private def self.encrypted_password(password, salt) string_to_hash = password + "wibble...
2007 Oct 23
11
validates_confirmation_of not working?
...er = self.find_by_username(username) if user expected_password = encrypted_password(password, user.salt) if user.hashed_password != expected_password user = nil end end user end def password @password end def password=(pwd) @password = pwd create_new_salt self.hashed_password = User.encrypted_password(self.password, self.salt) end private def self.encrypted_password(password, salt) string_to_hash = password + "wibble" + salt Digest::SHA1.hexdigest(string_to_hash) end def create_new_salt self.salt = self.object_...