update authentication system to Devise

This commit is contained in:
Lee Lawlor
2014-03-13 19:16:35 -04:00
parent 4c9886612f
commit 774543e678
78 changed files with 1257 additions and 385 deletions

View File

@ -0,0 +1,35 @@
class AddDeviseToUsers < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0, :null => false
end
# remove authlogic stuff
remove_column :users, :persistence_token
remove_column :users, :perishable_token
# modify authlogic stuff
rename_column :users, :crypted_password, :encrypted_password
rename_column :users, :current_login_at, :current_sign_in_at
rename_column :users, :last_login_at, :last_sign_in_at
rename_column :users, :current_login_ip, :current_sign_in_ip
rename_column :users, :last_login_ip, :last_sign_in_ip
add_index :users, :reset_password_token, :unique => true
end
def self.down
# By default, we don't want to make any assumption about how to roll back a migration when your
# model already existed. Please edit below which fields you would like to remove in this migration.
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -0,0 +1,6 @@
class RemoveNotnullFromUsersPasswordSalt < ActiveRecord::Migration
def change
change_column :users, :password_salt, :string, :null => true
end
end

View File

@ -0,0 +1,6 @@
class AddAuthenticationTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication_token, :string
add_index :users, :authentication_token
end
end