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:
11
db/migrate/20110809130610_add_password_hash_to_users.rb
Normal file
11
db/migrate/20110809130610_add_password_hash_to_users.rb
Normal 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
|
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110805201426) do
|
||||
ActiveRecord::Schema.define(:version => 20110809130610) do
|
||||
|
||||
create_table "playlists", :force => true do |t|
|
||||
t.string "name"
|
||||
@@ -38,9 +38,9 @@ ActiveRecord::Schema.define(:version => 20110805201426) do
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "email"
|
||||
t.string "password"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "password_hash"
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user