Ruby on rails 设计-可确认不发送电子邮件
我只是想说:我的应用程序中确实有电子邮件 我刚刚添加了:confirmable到我的用户模型 app/models/user.rbRuby on rails 设计-可确认不发送电子邮件,ruby-on-rails,devise,Ruby On Rails,Devise,我只是想说:我的应用程序中确实有电子邮件 我刚刚添加了:confirmable到我的用户模型 app/models/user.rb devise :database_authenticatable, :registerable, :omniauthable, :recoverable, :rememberable, :trackable, :validatable, :confirmable create_table "users", :force => true do |t|
devise :database_authenticatable, :registerable, :omniauthable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
create_table "users", :force => true do |t|
...
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
end
def create
super
session[:omniauth] = nil unless @user.new_record?
end
我在db中有可确认部分:
db/schema.rb
devise :database_authenticatable, :registerable, :omniauthable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
create_table "users", :force => true do |t|
...
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
end
def create
super
session[:omniauth] = nil unless @user.new_record?
end
由于omniauth,我已覆盖了控制器的注册:
应用程序/控制器/注册\u controller.rb
devise :database_authenticatable, :registerable, :omniauthable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
create_table "users", :force => true do |t|
...
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
end
def create
super
session[:omniauth] = nil unless @user.new_record?
end
所以我想弄明白的是…为了:
更新:现在,当我创建一个用户时,它会被自动确认。为什么会这样?好的,所以我没有意识到我的用户模型中有以下内容:
def send_confirmation_instructions
# stops Devise from automatically sending a confirmation email
end
def confirmation_required?
skip_confirmation!
end
对它们进行评论会得到要发送的电子邮件。如果用户未被确认,仍在尝试在登录后如何重定向。并试图找出如何正确使用所需的确认信息