Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
a97c65320d | |||
b5caa37646 | |||
72abc0114f | |||
8b14bc0db6 | |||
96cd2af9ac | |||
207c11f2cc | |||
b0797d241d | |||
7ba1305c88 | |||
6172e477b1 | |||
6e7e799a82 | |||
d9f13671d3 |
10 changed files with 26 additions and 12 deletions
|
@ -122,4 +122,7 @@ if config_env() == :prod do
|
|||
# config :swoosh, :api_client, Swoosh.ApiClient.Hackney
|
||||
#
|
||||
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
|
||||
config :exmr, Exmr.Mailer,
|
||||
adapter: Swoosh.Adapters.Brevo,
|
||||
api_key: System.get_env("BREVO_EMAIL_API_KEY")
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ defmodule Exmr.Users.UserNotifier do
|
|||
email =
|
||||
new()
|
||||
|> to(recipient)
|
||||
|> from({"Exmr", "contact@example.com"})
|
||||
|> from({"Exmr", "contact@vavakado.xyz"})
|
||||
|> subject(subject)
|
||||
|> text_body(body)
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ defmodule ExmrWeb.ExamLive.Index do
|
|||
def mount(_params, _session, socket) do
|
||||
socket =
|
||||
socket
|
||||
|> assign(:exams, Exams.list_exams())
|
||||
|> assign(:sort_by, "date")
|
||||
|> assign(:exams, sort_items(Exams.list_exams(), "date"))
|
||||
|> assign(:live_action, :index)
|
||||
|> assign(exam: %{})
|
||||
|> assign(events: Enum.group_by(Exams.list_exams(), & &1.date))
|
||||
|
|
|
@ -111,7 +111,15 @@
|
|||
<%= if Map.has_key?(@events, date) do %>
|
||||
<ul class="text-xs">
|
||||
<%= for event <- @events[date] do %>
|
||||
<li id={"event-#{event.id}"}>{event.subject}</li>
|
||||
<li id={"event-#{event.id}"}>
|
||||
<button
|
||||
phx-click="edit"
|
||||
phx-value-id={event.id}
|
||||
class="hover:border-b hover:border-solid border-none border-green-700 dark:border-green-300"
|
||||
>
|
||||
{event.subject}
|
||||
</button>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
3
mix.exs
3
mix.exs
|
@ -4,7 +4,7 @@ defmodule Exmr.MixProject do
|
|||
def project do
|
||||
[
|
||||
app: :exmr,
|
||||
version: "0.2.2",
|
||||
version: "0.2.3",
|
||||
elixir: "~> 1.14",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
start_permanent: Mix.env() == :prod,
|
||||
|
@ -57,6 +57,7 @@ defmodule Exmr.MixProject do
|
|||
{:telemetry_metrics, "~> 1.0"},
|
||||
{:telemetry_poller, "~> 1.0"},
|
||||
{:gettext, "~> 0.20"},
|
||||
{:gen_smtp, "~> 1.2"},
|
||||
{:jason, "~> 1.2"},
|
||||
{:dns_cluster, "~> 0.1.1"},
|
||||
{:bandit, "~> 1.5"}
|
||||
|
|
2
mix.lock
2
mix.lock
|
@ -16,6 +16,7 @@
|
|||
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
|
||||
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
|
||||
"floki": {:hex, :floki, "0.37.0", "b83e0280bbc6372f2a403b2848013650b16640cd2470aea6701f0632223d719e", [:mix], [], "hexpm", "516a0c15a69f78c47dc8e0b9b3724b29608aa6619379f91b1ffa47109b5d0dd3"},
|
||||
"gen_smtp": {:hex, :gen_smtp, "1.2.0", "9cfc75c72a8821588b9b9fe947ae5ab2aed95a052b81237e0928633a13276fd3", [:rebar3], [{:ranch, ">= 1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "5ee0375680bca8f20c4d85f58c2894441443a743355430ff33a783fe03296779"},
|
||||
"gettext": {:hex, :gettext, "0.26.2", "5978aa7b21fada6deabf1f6341ddba50bc69c999e812211903b169799208f2a8", [:mix], [{:expo, "~> 0.5.1 or ~> 1.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "aa978504bcf76511efdc22d580ba08e2279caab1066b76bb9aa81c4a1e0a32a5"},
|
||||
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized", depth: 1]},
|
||||
"hpax": {:hex, :hpax, "1.0.1", "c857057f89e8bd71d97d9042e009df2a42705d6d690d54eca84c8b29af0787b0", [:mix], [], "hexpm", "4e2d5a4f76ae1e3048f35ae7adb1641c36265510a2d4638157fbcb53dda38445"},
|
||||
|
@ -35,6 +36,7 @@
|
|||
"plug": {:hex, :plug, "1.16.1", "40c74619c12f82736d2214557dedec2e9762029b2438d6d175c5074c933edc9d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a13ff6b9006b03d7e33874945b2755253841b238c34071ed85b0e86057f8cddc"},
|
||||
"plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"},
|
||||
"postgrex": {:hex, :postgrex, "0.19.3", "a0bda6e3bc75ec07fca5b0a89bffd242ca209a4822a9533e7d3e84ee80707e19", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "d31c28053655b78f47f948c85bb1cf86a9c1f8ead346ba1aa0d0df017fa05b61"},
|
||||
"ranch": {:hex, :ranch, "2.1.0", "2261f9ed9574dcfcc444106b9f6da155e6e540b2f82ba3d42b339b93673b72a3", [:make, :rebar3], [], "hexpm", "244ee3fa2a6175270d8e1fc59024fd9dbc76294a321057de8f803b1479e76916"},
|
||||
"swoosh": {:hex, :swoosh, "1.17.3", "5cda7bff6bc1121cc5b58db8ed90ef33261b373425ae3e32dd599688037a0482", [:mix], [{:bandit, ">= 1.0.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mua, "~> 0.2.3", [hex: :mua, repo: "hexpm", optional: true]}, {:multipart, "~> 0.4", [hex: :multipart, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.5 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "14ad57cfbb70af57323e17f569f5840a33c01f8ebc531dd3846beef3c9c95e55"},
|
||||
"tailwind": {:hex, :tailwind, "0.2.4", "5706ec47182d4e7045901302bf3a333e80f3d1af65c442ba9a9eed152fb26c2e", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "c6e4a82b8727bab593700c998a4d98cf3d8025678bfde059aed71d0000c3e463"},
|
||||
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
|
||||
|
|
|
@ -8,7 +8,7 @@ defmodule Exmr.UsersTest do
|
|||
|
||||
describe "get_user_by_email/1" do
|
||||
test "does not return the user if the email does not exist" do
|
||||
refute Users.get_user_by_email("unknown@example.com")
|
||||
refute Users.get_user_by_email("unknown@vavakado.xyz")
|
||||
end
|
||||
|
||||
test "returns the user if the email exists" do
|
||||
|
@ -19,7 +19,7 @@ defmodule Exmr.UsersTest do
|
|||
|
||||
describe "get_user_by_email_and_password/2" do
|
||||
test "does not return the user if the email does not exist" do
|
||||
refute Users.get_user_by_email_and_password("unknown@example.com", "hello world!")
|
||||
refute Users.get_user_by_email_and_password("unknown@vavakado.xyz", "hello world!")
|
||||
end
|
||||
|
||||
test "does not return the user if the password is not valid" do
|
||||
|
@ -182,14 +182,14 @@ defmodule Exmr.UsersTest do
|
|||
test "sends token through notification", %{user: user} do
|
||||
token =
|
||||
extract_user_token(fn url ->
|
||||
Users.deliver_user_update_email_instructions(user, "current@example.com", url)
|
||||
Users.deliver_user_update_email_instructions(user, "current@vavakado.xyz", url)
|
||||
end)
|
||||
|
||||
{:ok, token} = Base.url_decode64(token, padding: false)
|
||||
assert user_token = Repo.get_by(UserToken, token: :crypto.hash(:sha256, token))
|
||||
assert user_token.user_id == user.id
|
||||
assert user_token.sent_to == user.email
|
||||
assert user_token.context == "change:current@example.com"
|
||||
assert user_token.context == "change:current@vavakado.xyz"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -223,7 +223,7 @@ defmodule Exmr.UsersTest do
|
|||
end
|
||||
|
||||
test "does not update email if user email changed", %{user: user, token: token} do
|
||||
assert Users.update_user_email(%{user | email: "current@example.com"}, token) == :error
|
||||
assert Users.update_user_email(%{user | email: "current@vavakado.xyz"}, token) == :error
|
||||
assert Repo.get!(User, user.id).email == user.email
|
||||
assert Repo.get_by(UserToken, user_id: user.id)
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ defmodule ExmrWeb.UserConfirmationInstructionsLiveTest do
|
|||
|
||||
{:ok, conn} =
|
||||
lv
|
||||
|> form("#resend_confirmation_form", user: %{email: "unknown@example.com"})
|
||||
|> form("#resend_confirmation_form", user: %{email: "unknown@vavakado.xyz"})
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, ~p"/")
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ defmodule ExmrWeb.UserForgotPasswordLiveTest do
|
|||
|
||||
{:ok, conn} =
|
||||
lv
|
||||
|> form("#reset_password_form", user: %{"email" => "unknown@example.com"})
|
||||
|> form("#reset_password_form", user: %{"email" => "unknown@vavakado.xyz"})
|
||||
|> render_submit()
|
||||
|> follow_redirect(conn, "/")
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ defmodule Exmr.UsersFixtures do
|
|||
entities via the `Exmr.Users` context.
|
||||
"""
|
||||
|
||||
def unique_user_email, do: "user#{System.unique_integer()}@example.com"
|
||||
def unique_user_email, do: "user#{System.unique_integer()}@vavakado.xyz"
|
||||
def valid_user_password, do: "hello world!"
|
||||
|
||||
def valid_user_attributes(attrs \\ %{}) do
|
||||
|
|
Loading…
Reference in a new issue