Compare commits
No commits in common. "1276635a3ea7a3877904023d4acb0e3bb842b457" and "35de8a6395a7b86b5f18f2ebcb0422d34d4d7224" have entirely different histories.
1276635a3e
...
35de8a6395
@ -29,28 +29,33 @@ defmodule Memex.Email do
|
||||
def generate_email("welcome", user, %{"url" => url}) do
|
||||
user
|
||||
|> base_email(dgettext("emails", "confirm your memEx account"))
|
||||
|> render_body(:confirm_email, %{user: user, url: url})
|
||||
|> html_email(:confirm_email_html, %{user: user, url: url})
|
||||
|> text_email(:confirm_email_text, %{user: user, url: url})
|
||||
end
|
||||
|
||||
def generate_email("reset_password", user, %{"url" => url}) do
|
||||
user
|
||||
|> base_email(dgettext("emails", "reset your memEx password"))
|
||||
|> render_body(:reset_password, %{user: user, url: url})
|
||||
|> html_email(:reset_password_html, %{user: user, url: url})
|
||||
|> text_email(:reset_password_text, %{user: user, url: url})
|
||||
end
|
||||
|
||||
def generate_email("update_email", user, %{"url" => url}) do
|
||||
user
|
||||
|> base_email(dgettext("emails", "update your memEx email"))
|
||||
|> render_body(:update_email, %{user: user, url: url})
|
||||
|> html_email(:update_email_html, %{user: user, url: url})
|
||||
|> text_email(:update_email_text, %{user: user, url: url})
|
||||
end
|
||||
|
||||
defp render_body(email, template, assigns) do
|
||||
html_heex = apply(EmailHTML, String.to_existing_atom("#{template}_html"), [assigns])
|
||||
html = render_to_string(Layouts, "email_html", "html", email: email, inner_content: html_heex)
|
||||
defp html_email(email, atom, assigns) do
|
||||
heex = apply(EmailHTML, atom, [assigns])
|
||||
html = render_to_string(Layouts, "email_html", "html", email: email, inner_content: heex)
|
||||
email |> html_body(html)
|
||||
end
|
||||
|
||||
text_heex = apply(EmailHTML, String.to_existing_atom("#{template}_text"), [assigns])
|
||||
text = render_to_string(Layouts, "email_text", "text", email: email, inner_content: text_heex)
|
||||
|
||||
email |> html_body(html) |> text_body(text)
|
||||
defp text_email(email, atom, assigns) do
|
||||
heex = apply(EmailHTML, atom, [assigns])
|
||||
text = render_to_string(Layouts, "email_text", "text", email: email, inner_content: heex)
|
||||
email |> text_body(text)
|
||||
end
|
||||
end
|
||||
|
@ -22,6 +22,8 @@ defmodule MemexWeb.Router do
|
||||
plug :accepts, ["json"]
|
||||
end
|
||||
|
||||
## Authentication routes
|
||||
|
||||
scope "/", MemexWeb do
|
||||
pipe_through [:browser, :redirect_if_user_is_authenticated]
|
||||
|
||||
@ -38,12 +40,6 @@ defmodule MemexWeb.Router do
|
||||
scope "/", MemexWeb do
|
||||
pipe_through [:browser, :require_authenticated_user]
|
||||
|
||||
get "/users/settings", UserSettingsController, :edit
|
||||
put "/users/settings", UserSettingsController, :update
|
||||
delete "/users/settings/:id", UserSettingsController, :delete
|
||||
get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email
|
||||
get "/export/:mode", ExportController, :export
|
||||
|
||||
live_session :default, on_mount: [{MemexWeb.UserAuth, :ensure_authenticated}] do
|
||||
live "/notes/new", NoteLive.Index, :new
|
||||
live "/notes/:slug/edit", NoteLive.Index, :edit
|
||||
@ -59,16 +55,17 @@ defmodule MemexWeb.Router do
|
||||
live "/pipeline/:slug/add_step", PipelineLive.Show, :add_step
|
||||
live "/pipeline/:slug/:step_id", PipelineLive.Show, :edit_step
|
||||
end
|
||||
|
||||
get "/users/settings", UserSettingsController, :edit
|
||||
put "/users/settings", UserSettingsController, :update
|
||||
delete "/users/settings/:id", UserSettingsController, :delete
|
||||
get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email
|
||||
get "/export/:mode", ExportController, :export
|
||||
end
|
||||
|
||||
scope "/", MemexWeb do
|
||||
pipe_through [:browser]
|
||||
|
||||
delete "/users/log_out", UserSessionController, :delete
|
||||
get "/users/confirm", UserConfirmationController, :new
|
||||
post "/users/confirm", UserConfirmationController, :create
|
||||
get "/users/confirm/:token", UserConfirmationController, :confirm
|
||||
|
||||
live_session :public, on_mount: [{MemexWeb.UserAuth, :mount_current_user}] do
|
||||
live "/", HomeLive
|
||||
live "/faq", FaqLive
|
||||
@ -90,8 +87,6 @@ defmodule MemexWeb.Router do
|
||||
scope "/", MemexWeb do
|
||||
pipe_through [:browser, :require_authenticated_user, :require_admin]
|
||||
|
||||
live_dashboard "/dashboard", metrics: MemexWeb.Telemetry, ecto_repos: [Memex.Repo]
|
||||
|
||||
live_session :admin, on_mount: [{MemexWeb.UserAuth, :ensure_admin}] do
|
||||
live "/invites", InviteLive.Index, :index
|
||||
live "/invites/new", InviteLive.Index, :new
|
||||
@ -99,6 +94,21 @@ defmodule MemexWeb.Router do
|
||||
end
|
||||
end
|
||||
|
||||
scope "/", MemexWeb do
|
||||
pipe_through [:browser, :require_authenticated_user, :require_admin]
|
||||
|
||||
live_dashboard "/dashboard", metrics: MemexWeb.Telemetry, ecto_repos: [Memex.Repo]
|
||||
end
|
||||
|
||||
scope "/", MemexWeb do
|
||||
pipe_through [:browser]
|
||||
|
||||
delete "/users/log_out", UserSessionController, :delete
|
||||
get "/users/confirm", UserConfirmationController, :new
|
||||
post "/users/confirm", UserConfirmationController, :create
|
||||
get "/users/confirm/:token", UserConfirmationController, :confirm
|
||||
end
|
||||
|
||||
# Enables the Swoosh mailbox preview in development.
|
||||
#
|
||||
# Note that preview only shows emails that were sent by the same
|
||||
|
@ -71,7 +71,7 @@ msgstr ""
|
||||
msgid "confirm your memEx account"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex/accounts/email.ex:37
|
||||
#: lib/memex/accounts/email.ex:38
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "reset your memEx password"
|
||||
msgstr ""
|
||||
@ -86,7 +86,7 @@ msgstr ""
|
||||
msgid "this email was sent from memEx at %{url}"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex/accounts/email.ex:43
|
||||
#: lib/memex/accounts/email.ex:45
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "update your memEx email"
|
||||
msgstr ""
|
||||
|
@ -71,7 +71,7 @@ msgstr ""
|
||||
msgid "confirm your memEx account"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex/accounts/email.ex:37
|
||||
#: lib/memex/accounts/email.ex:38
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "reset your memEx password"
|
||||
msgstr ""
|
||||
@ -86,7 +86,7 @@ msgstr ""
|
||||
msgid "this email was sent from memEx at %{url}"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex/accounts/email.ex:43
|
||||
#: lib/memex/accounts/email.ex:45
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "update your memEx email"
|
||||
msgstr ""
|
||||
|
@ -72,7 +72,7 @@ msgstr ""
|
||||
msgid "confirm your memEx account"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex/accounts/email.ex:37
|
||||
#: lib/memex/accounts/email.ex:38
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "reset your memEx password"
|
||||
msgstr ""
|
||||
@ -87,7 +87,7 @@ msgstr ""
|
||||
msgid "this email was sent from memEx at %{url}"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex/accounts/email.ex:43
|
||||
#: lib/memex/accounts/email.ex:45
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "update your memEx email"
|
||||
msgstr ""
|
||||
|
Loading…
Reference in New Issue
Block a user