Save user password as a bcrypt hash

* Replace password field by password_hash
* Add User#password attribute
* Implement password hashing and verification with BCrypt mixin
This commit is contained in:
Thibault Jouan
2011-08-09 17:04:47 +00:00
parent 0fb9496fb3
commit 1fc3be42de
4 changed files with 58 additions and 5 deletions

View File

@@ -0,0 +1,11 @@
class AddPasswordHashToUsers < ActiveRecord::Migration
def self.up
add_column :users, :password_hash, :string
remove_column :users, :password
end
def self.down
remove_column :users, :password_hash
add_column :users, :password, :string
end
end