Trying to get authlogic running

This commit is contained in:
Christoph Haas 2015-07-13 18:42:36 +02:00
parent 06f09c0486
commit 737ff62cfc
23 changed files with 306 additions and 4 deletions

View file

@ -0,0 +1,23 @@
class ChangeUsersToAuthlogic < ActiveRecord::Migration
def change
change_table :users do |t|
# Remove the password column that was previously introduced
t.remove :password
# Create AuthLogic fields
t.string :password_salt, :null => false # optional, but highly recommended
t.string :persistence_token, :null => false # required
# Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
t.integer :login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
end
change_column :packages, :long_description, :text
end
end

View file

@ -0,0 +1,13 @@
class CreateUserSessions < ActiveRecord::Migration
def change
create_table :user_sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :user_sessions, :session_id
add_index :user_sessions, :updated_at
end
end