Miercoles
This commit is contained in:
parent
b7ed61c490
commit
9b00cedf2e
@ -29,8 +29,28 @@ config :derivantes, DerivantesWeb.Endpoint,
|
||||
#
|
||||
# For production it's recommended to configure a different adapter
|
||||
# at the `config/runtime.exs`.
|
||||
config :derivantes, Derivantes.Mailer, adapter: Swoosh.Adapters.Local
|
||||
|
||||
config :derivantes, Derivantes.Mailer,
|
||||
|
||||
adapter: Swoosh.Adapters.SMTP,
|
||||
relay: "mail.rmitacriocuarto.com.ar",
|
||||
username: "informedigital@rmitacriocuarto.com.ar",
|
||||
password: "Infotomo2020+",
|
||||
auth: :always,
|
||||
ssl: true,
|
||||
port: 465,
|
||||
retries: 10,
|
||||
sockopts: [
|
||||
versions: [:"tlsv1.2", :"tlsv1.3"],
|
||||
verify: :verify_peer,
|
||||
cacerts: :public_key.cacerts_get(),
|
||||
depth: 3,
|
||||
customize_hostname_check: [
|
||||
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
|
||||
],
|
||||
server_name_indication: 'mail.rmitacriocuarto.com.ar'
|
||||
]
|
||||
|
||||
# Configure esbuild (the version is required)
|
||||
config :esbuild,
|
||||
version: "0.17.11",
|
||||
|
@ -5,7 +5,7 @@ config :derivantes, Derivantes.Repo,
|
||||
username: "postgres",
|
||||
password: "1nf0rm3",
|
||||
hostname: "localhost",
|
||||
port: 5555,
|
||||
port: 5432,
|
||||
database: "derivantes",
|
||||
stacktrace: true,
|
||||
show_sensitive_data_on_connection_error: true,
|
||||
|
@ -114,4 +114,26 @@ if config_env() == :prod do
|
||||
# config :swoosh, :api_client, Swoosh.ApiClient.Hackney
|
||||
#
|
||||
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
|
||||
|
||||
config :derivantes, Derivantes.Mailer, adapter: Swoosh.Adapters.Local,
|
||||
|
||||
adapter: Swoosh.Adapters.SMTP,
|
||||
relay: "mail.rmitacriocuarto.com.ar",
|
||||
username: "informedigital@rmitacriocuarto.com.ar",
|
||||
password: "Infotomo2020+",
|
||||
auth: :always,
|
||||
ssl: true,
|
||||
port: 465,
|
||||
retries: 10,
|
||||
sockopts: [
|
||||
versions: [:"tlsv1.2", :"tlsv1.3"],
|
||||
verify: :verify_peer,
|
||||
cacerts: :public_key.cacerts_get(),
|
||||
depth: 3,
|
||||
customize_hostname_check: [
|
||||
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
|
||||
],
|
||||
server_name_indication: 'mail.rmitacriocuarto.com.ar'
|
||||
]
|
||||
|
||||
end
|
||||
|
@ -8,13 +8,15 @@ defmodule Derivantes.Accounts.UserNotifier do
|
||||
email =
|
||||
new()
|
||||
|> to(recipient)
|
||||
|> from({"Derivantes", "contact@example.com"})
|
||||
|> from({"Derivantes", "informedigital@rmitacriocuarto.com.ar"})
|
||||
|> subject(subject)
|
||||
|> text_body(body)
|
||||
|
||||
with {:ok, _metadata} <- Mailer.deliver(email) do
|
||||
{:ok, email}
|
||||
end
|
||||
|> Mailer.deliver()
|
||||
|>IO.inspect()
|
||||
# with {:ok, _metadata} <- Mailer.deliver(email) do
|
||||
# {:ok, email}
|
||||
# end
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
26
lib/derivantes_web/live/test/index.ex
Normal file
26
lib/derivantes_web/live/test/index.ex
Normal file
@ -0,0 +1,26 @@
|
||||
defmodule DerivantesWeb.TestLive do
|
||||
|
||||
use DerivantesWeb, :live_view
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
|
||||
{:ok, socket}
|
||||
|
||||
end
|
||||
|
||||
def handle_event(msg, _params, socket) do
|
||||
case msg do
|
||||
_-> {:noreply, socket}
|
||||
end
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
|
||||
~H"""
|
||||
<h1> Nuevo plug </h1>
|
||||
|
||||
"""
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -72,6 +72,16 @@ defmodule DerivantesWeb.Router do
|
||||
end
|
||||
end
|
||||
|
||||
scope "/", DerivantesWeb do
|
||||
pipe_through [:browser, :require_confirmed_user]
|
||||
|
||||
live_session :require_confirmed_user,
|
||||
on_mount: [{DerivantesWeb.UserAuth, :ensure_authentcated}] do
|
||||
live "/test", TestLive, :index
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scope "/", DerivantesWeb do
|
||||
pipe_through [:browser]
|
||||
|
||||
|
@ -183,7 +183,7 @@ defmodule DerivantesWeb.UserAuth do
|
||||
end
|
||||
|
||||
@doc """
|
||||
Used for routes that require the user to not be authenticated.
|
||||
Used for routes that eequire the user to not be authenticated.
|
||||
"""
|
||||
def redirect_if_user_is_authenticated(conn, _opts) do
|
||||
if conn.assigns[:current_user] do
|
||||
@ -203,6 +203,7 @@ defmodule DerivantesWeb.UserAuth do
|
||||
"""
|
||||
def require_authenticated_user(conn, _opts) do
|
||||
if conn.assigns[:current_user] do
|
||||
IO.inspect(conn.assigns[:current_user].inserted_at)
|
||||
conn
|
||||
else
|
||||
conn
|
||||
@ -213,6 +214,20 @@ defmodule DerivantesWeb.UserAuth do
|
||||
end
|
||||
end
|
||||
|
||||
def require_confirmed_user(conn, _opts) do
|
||||
|
||||
if conn.assigns[:current_user] do
|
||||
conn
|
||||
else
|
||||
conn
|
||||
|> put_flash(:error, "Necesita validar su email. Revise su casilla de entrada.")
|
||||
|> maybe_store_return_to()
|
||||
|> redirect(to: ~p"/users/log_in")
|
||||
|> halt()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
defp put_token_in_session(conn, token) do
|
||||
conn
|
||||
|> put_session(:user_token, token)
|
||||
|
1
mix.exs
1
mix.exs
@ -51,6 +51,7 @@ defmodule Derivantes.MixProject do
|
||||
{:gettext, "~> 0.20"},
|
||||
{:jason, "~> 1.2"},
|
||||
{:dns_cluster, "~> 0.1.1"},
|
||||
{:gen_smtp, ">= 0.0.0"},
|
||||
{:plug_cowboy, "~> 2.5"}
|
||||
]
|
||||
end
|
||||
|
1
mix.lock
1
mix.lock
@ -16,6 +16,7 @@
|
||||
"file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"},
|
||||
"finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"},
|
||||
"floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"},
|
||||
"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.24.0", "6f4d90ac5f3111673cbefc4ebee96fe5f37a114861ab8c7b7d5b30a1108ce6d8", [:mix], [{:expo, "~> 0.5.1", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "bdf75cdfcbe9e4622dd18e034b227d77dd17f0f133853a1c73b97b3d6c770e8b"},
|
||||
"hpax": {:hex, :hpax, "0.2.0", "5a58219adcb75977b2edce5eb22051de9362f08236220c9e859a47111c194ff5", [:mix], [], "hexpm", "bea06558cdae85bed075e6c036993d43cd54d447f76d8190a8db0dc5893fa2f1"},
|
||||
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
|
||||
|
BIN
tailwind-freebsd-x64
Normal file
BIN
tailwind-freebsd-x64
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user