When the user requests a reset-link sent to his email using Devise views, he receives an email with this content:
Hello example@gmail.com!
Someone has requested a link to change your password. You can do this through the link below.
Change my password
(which points to)
localhost:3000/users/password/edit?reset_password_token=some_token
If you didn't request this, please ignore this email.
Your password won't change until you access the link above and create a new one.
Now, this is all cool and dandy, except when I host the rails server on a different port, say
rails server -p 5678
Then the link still points to localhost:3000
.
I know about request.ip
and request.port
, but I cannot find out where to change the Devise mailer objects. The relevant part of the mail-template used for this mail is
<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
After debugging, it seems @resource
is a User
-object and this contains no URL.
Long story short: How can I make the url (ip/port part) of Devise mails be dynamic?