-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable confirmation URL + IPs stored in plain format #328
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 7117fb8.
Can you please explain the use case for using the "EXTERNAL_HOSTNAME" env variable? The system already creates the url based on the Endpoint's http: [host: "..."] and https: [host: "..."] configuration. So I don't see the need to have a separate env variable. Am I missing something? |
Hey @smpallen99, thanks for replying! This env variable might not have the best name, but in my use case, this arises from using the coherence in a microservice. So what I end up with is Hope this makes sense. I'm more than willing to change this to a more sensible solution in case I have misunderstood something. |
Hey @smpallen99, any thoughts on this? |
Sorry for the delay getting back to you on this @sashman. I've reviewed the PR and have some comments:
I just tried this in a test project with my master branch. The only file that needs changing is Code.ensure_loaded Phoenix.Swoosh
defmodule CohMassAssignWeb.Coherence.UserEmail do
@moduledoc false
use Phoenix.Swoosh, view: CohMassAssignWeb.Coherence.EmailView, layout: {CohMassAssignWeb.Coherence.LayoutView, :email}
alias Swoosh.Email
require Logger
alias Coherence.Config
import CohMassAssignWeb.Gettext
defp site_name, do: Config.site_name(inspect Config.module)
def password(user, url) do
Logger.info "reset url: #{inspect url}"
url = external_url(url) # add this line to each of the mail functions
Logger.info "reset external url: #{inspect url}"
%Email{}
|> from(from_email())
|> to(user_email(user))
|> add_reply_to()
|> subject(dgettext("coherence", "%{site_name} - Reset password instructions", site_name: site_name()))
|> render_body("password.html", %{url: url, name: first_name(user.name)})
end
def confirmation(user, url) do
url = external_url(url)
# ...
end
# ...
defp external_url(url) do
base_url = CohMassAssignWeb.Router.Helpers.url(CohMassAssignWeb.Endpoint)
String.replace(url, base_url, Application.get_env(:coh_mass_assign, :external_url, base_url))
end
end By adding a What do you think? |
To configure confirmation URL