开发者

Rails3 + Devise: edit_password_url spits out http//www.blah.com (No colon the http!)

开发者 https://www.devze.com 2023-03-13 06:00 出处:网络
When a user gets mailed the change password link in our app from our production server, for whatever reason, they\'re getting an absolute url without the colon the http://. As a r开发者_开发技巧esult,

When a user gets mailed the change password link in our app from our production server, for whatever reason, they're getting an absolute url without the colon the http://. As a r开发者_开发技巧esult, people are complaining the link doesn't work.

The issue only occurs on my production environment, but I do have this set in /config/environments/production.rb:

config.action_mailer.default_url_options = { :host => 'http://www.blah.com' }

So I'm not sure what the issue could be. I've also searched the entire site for the string "http//" to see if it was just a typo in a setting someplace, but no dice.

The confirmation_instructions.html.erb itself is untouched and the link is generated as such:

<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

So what the crap would cause my server to drop the : from http://?? Has anyone ever run across this issue before? Any theories on how to fix it? Thanks in advance!


I ran into this problem too. The issue (oddly) is that you're using a full URL in the default_url_options (:host => 'http://www.blah.com'). If you put www.blah.com instead it appears to work. I ran into this problem last night and this was the quickest fix for me.


Create new mailer extended Devise::Mailer and override his methods:

def reset_password_instructions(record)
end
def confirmation_instructions(record)
end
def unlock_instructions(record)
end

Next go to config / initializers / devise.rb and remove hashes before config.mailer Set in this place your own mailer.

Thats all

0

精彩评论

暂无评论...
验证码 换一张
取 消