Authlogicのその他の機能
Authlogicには色んな機能が設定可能。細かいところはrdocに書いてあります。http://rdoc.info/projects/binarylogic/authlogic
- Want to use another encryption algorithm, such as BCrypt? See Authlogic::ActsAsAuthentic::Password::Config
- 別の暗号化アルゴリズムも使えるよ
- Migrating from restful_authentication? See Authlogic::ActsAsAuthentic::RestfulAuthentication::Config
- restful_authenticationからデータをマイグレートできるよ
- Want to timeout sessions after a period if inactivity? See Authlogic::Session::Timeout
- タイムアウトの設定もできる
- Need to scope your sessions to an account or parent model? See Authlogic::AuthenticatesMany
- アカウントのモデルにセッションの関連を設定できるらしい。よくわかんないっす
- Need multiple session types in your app? Check out Authlogic::Session::Id
- いそんなセッションの種類が使えるらしい。同じユーザーで複数のセッションを作っちゃったりもできるらしいっす。
- Need to reset passwords or activate accounts? Use the perishable token. See Authlogic::ActsAsAuthentic::PerishableToken
- パスワードのリセット、アカウントの有効化の機能とか
- Need to give API access or access to a private feed? Use basic HTTP auth or authentication by params. See Authlogic::Session::HttpAuth or Authlogic::Session::Params
- Need help testing? See the Authlogic::TestCase
- テストのサポートもある
個人的には restful_authenticationのusersテーブルからマイグレートできるのは嬉しい。
あ、あと、usersテーブルに以下のカラムを追加しておくと勝手にデータを入れてくれるらしい。
# 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