アプリケーションの認証にDeviseを使用しています。ユーザーがサインアップするときに確認メールを要求したくありませんが、ユーザーがアプリに更新メールを送信することを希望する場合は確認を要求します。これは、Deviseの組み込みの:confirmable機能で可能ですか?ユーザーが確認せずにログインできる時間を設定する設定を見つけましたが、基本的には「永久」に設定したいと思います。
2 に答える
1
https://github.com/plataformatec/devise/blob/master/lib/devise/models/confirmable.rbをチェックしてください。おそらくconfirmation_period_valid?
、alwaysを返すことでオーバーライドできますtrue
。
あるいは、設定をのようなものに変更することもできます。10000.years.from_now
これは、「永遠に」の見積もりとしては十分かもしれません。
于 2012-10-13T03:36:55.817 に答える
0
探してconfig/initializers/devise.rb
ください
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
1000.yearsに設定します。次に、メソッドで、ユーザーが自分のアカウントを確認したかどうかをテストするためemail_updates
に呼び出します。#confirmed?
そうでない場合は、確認リンクを再送信するためにページに送信してください。これは、期限が切れている可能性が高いためです。
于 2017-04-15T18:46:27.130 に答える