【本家URL / Sorcery】Reset password

※1

2025/1/7 に確認した状態です。本家更新にはお気をつけて。

Patrick Crowley edited this page on Oct 16, 2020

>Patrick Crowleyさんが書いた 2020年10月16日時点の記事。

※2

緑色の文字は手入力した場所です。

⭐️下記から本家記事翻訳


このチュートリアルでは、Simple Password Authenticationで作成したアプリをベースにしているので、それを理解していることを確認してほしい。

まず、いくつかのDBフィールドを追加する:

rails g sorcery:install reset_password --only-submodules

その結果、どのようなものが生まれるのだろうか:

class SorceryResetPassword < ActiveRecord::Migration
  def change
    add_column :users, :reset_password_token, :string, default: nil
    add_column :users, :reset_password_token_expires_at, :datetime, default: nil
    add_column :users, :reset_password_email_sent_at, :datetime, default: nil
  end
end

そして