rutas cambiadas
This commit is contained in:
@ -162,7 +162,7 @@ defmodule Derivantes.Accounts do
|
||||
|
||||
## Examples
|
||||
|
||||
iex> deliver_user_update_email_instructions(user, current_email, &url(~p"/users/settings/confirm_email/#{&1})")
|
||||
iex> deliver_user_update_email_instructions(user, current_email, &url(~p"/derivantes/settings/confirm_email/#{&1})")
|
||||
{:ok, %{to: ..., body: ...}}
|
||||
|
||||
"""
|
||||
@ -249,10 +249,10 @@ defmodule Derivantes.Accounts do
|
||||
|
||||
## Examples
|
||||
|
||||
iex> deliver_user_confirmation_instructions(user, &url(~p"/users/confirm/#{&1}"))
|
||||
iex> deliver_user_confirmation_instructions(user, &url(~p"/derivantes/confirm/#{&1}"))
|
||||
{:ok, %{to: ..., body: ...}}
|
||||
|
||||
iex> deliver_user_confirmation_instructions(confirmed_user, &url(~p"/users/confirm/#{&1}"))
|
||||
iex> deliver_user_confirmation_instructions(confirmed_user, &url(~p"/derivantes/confirm/#{&1}"))
|
||||
{:error, :already_confirmed}
|
||||
|
||||
"""
|
||||
@ -296,7 +296,7 @@ defmodule Derivantes.Accounts do
|
||||
|
||||
## Examples
|
||||
|
||||
iex> deliver_user_reset_password_instructions(user, &url(~p"/users/reset_password/#{&1}"))
|
||||
iex> deliver_user_reset_password_instructions(user, &url(~p"/derivantes/reset_password/#{&1}"))
|
||||
{:ok, %{to: ..., body: ...}}
|
||||
|
||||
"""
|
||||
|
@ -10,6 +10,7 @@ defmodule Derivantes.Application do
|
||||
children = [
|
||||
DerivantesWeb.Telemetry,
|
||||
Derivantes.Repo,
|
||||
Derivantes.TdsRepo,
|
||||
{DNSCluster, query: Application.get_env(:derivantes, :dns_cluster_query) || :ignore},
|
||||
{Phoenix.PubSub, name: Derivantes.PubSub},
|
||||
# Start the Finch HTTP client for sending emails
|
||||
|
@ -201,9 +201,9 @@ defmodule DerivantesWeb.CoreComponents do
|
||||
def simple_form(assigns) do
|
||||
~H"""
|
||||
<.form :let={f} for={@for} as={@as} {@rest}>
|
||||
<div class="mt-10 space-y-8 bg-white">
|
||||
<div >
|
||||
<%= render_slot(@inner_block, f) %>
|
||||
<div :for={action <- @actions} class="mt-2 flex items-center justify-between gap-6">
|
||||
<div :for={action <- @actions}>
|
||||
<%= render_slot(action, f) %>
|
||||
</div>
|
||||
</div>
|
||||
@ -308,7 +308,7 @@ defmodule DerivantesWeb.CoreComponents do
|
||||
|
||||
~H"""
|
||||
<div phx-feedback-for={@name}>
|
||||
<label class="flex items-center gap-4 text-sm leading-6 text-zinc-600">
|
||||
<label class="flex items-center gap-4 text-sm leading-6 text-white">
|
||||
<input type="hidden" name={@name} value="false" />
|
||||
<input
|
||||
type="checkbox"
|
||||
@ -316,7 +316,7 @@ defmodule DerivantesWeb.CoreComponents do
|
||||
name={@name}
|
||||
value="true"
|
||||
checked={@checked}
|
||||
class="rounded border-zinc-300 text-zinc-900 focus:ring-0"
|
||||
class="rounded border-zinc-300 text-white focus:ring-0"
|
||||
{@rest}
|
||||
/>
|
||||
<%= @label %>
|
||||
@ -396,7 +396,7 @@ defmodule DerivantesWeb.CoreComponents do
|
||||
|
||||
def label(assigns) do
|
||||
~H"""
|
||||
<label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800">
|
||||
<label for={@for} class="block text-sm font-semibold leading-6 text-white">
|
||||
<%= render_slot(@inner_block) %>
|
||||
</label>
|
||||
"""
|
||||
|
@ -1,29 +1,3 @@
|
||||
<header class="px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex items-center justify-between border-b border-zinc-100 py-3 text-sm">
|
||||
<div class="flex items-center gap-4">
|
||||
<a href="/">
|
||||
<img src={~p"/images/logo.svg"} width="36" />
|
||||
</a>
|
||||
<p class="bg-brand/5 text-brand rounded-full px-2 font-medium leading-6">
|
||||
v<%= Application.spec(:phoenix, :vsn) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-4 font-semibold leading-6 text-zinc-900">
|
||||
<a href="https://twitter.com/elixirphoenix" class="hover:text-zinc-700">
|
||||
@elixirphoenix
|
||||
</a>
|
||||
<a href="https://github.com/phoenixframework/phoenix" class="hover:text-zinc-700">
|
||||
GitHub
|
||||
</a>
|
||||
<a
|
||||
href="https://hexdocs.pm/phoenix/overview.html"
|
||||
class="rounded-lg bg-zinc-100 px-2 py-1 hover:bg-zinc-200/80"
|
||||
>
|
||||
Get Started <span aria-hidden="true">→</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main class="px-4 py-20 sm:px-6 lg:px-8">
|
||||
<div class="mx-auto max-w-2xl">
|
||||
<.flash_group flash={@flash} />
|
||||
|
@ -19,7 +19,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<.link
|
||||
href={~p"/users/settings"}
|
||||
href={~p"/derivantes/settings"}
|
||||
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
||||
>
|
||||
Settings
|
||||
@ -27,7 +27,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<.link
|
||||
href={~p"/users/log_out"}
|
||||
href={~p"/derivantes/log_out"}
|
||||
method="delete"
|
||||
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
||||
>
|
||||
@ -37,7 +37,7 @@
|
||||
<% else %>
|
||||
<li>
|
||||
<.link
|
||||
href={~p"/users/register"}
|
||||
href={~p"/derivantes/register"}
|
||||
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
||||
>
|
||||
Register
|
||||
@ -45,7 +45,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<.link
|
||||
href={~p"/users/log_in"}
|
||||
href={~p"/derivantes/log_in"}
|
||||
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
||||
>
|
||||
Log in
|
||||
|
@ -10,7 +10,7 @@ defmodule DerivantesWeb.UserSessionController do
|
||||
|
||||
def create(conn, %{"_action" => "password_updated"} = params) do
|
||||
conn
|
||||
|> put_session(:user_return_to, ~p"/users/settings")
|
||||
|> put_session(:user_return_to, ~p"/derivantes/settings")
|
||||
|> create(params, "Password updated successfully!")
|
||||
end
|
||||
|
||||
@ -30,7 +30,7 @@ defmodule DerivantesWeb.UserSessionController do
|
||||
conn
|
||||
|> put_flash(:error, "Invalid email or password")
|
||||
|> put_flash(:email, String.slice(email, 0, 160))
|
||||
|> redirect(to: ~p"/users/log_in")
|
||||
|> redirect(to: ~p"/derivantes/log_in")
|
||||
end
|
||||
end
|
||||
|
||||
|
15
lib/derivantes_web/live/derivantes/derivantes_live.ex
Executable file
15
lib/derivantes_web/live/derivantes/derivantes_live.ex
Executable file
@ -0,0 +1,15 @@
|
||||
defmodule DerivantesWeb.DerivantesLive do
|
||||
use DerivantesWeb, :live_view
|
||||
use Phoenix.Component
|
||||
import Ecto.Query
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<h1> Listado </h1>
|
||||
"""
|
||||
end
|
||||
end
|
154
lib/derivantes_web/live/derivantes/derivanteshash_live.ex
Executable file
154
lib/derivantes_web/live/derivantes/derivanteshash_live.ex
Executable file
@ -0,0 +1,154 @@
|
||||
defmodule DerivantesWeb.DerivantesHashLive do
|
||||
use DerivantesWeb, :live_view
|
||||
use Phoenix.Component
|
||||
import Ecto.Query
|
||||
|
||||
def mount(params, _session, socket) do
|
||||
IO.inspect(params)
|
||||
hash = params["hash"]
|
||||
incorrecto = if hash != "123" do
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
IO.inspect(incorrecto)
|
||||
socket =
|
||||
socket
|
||||
|> assign(:dato_incorrecto, incorrecto)
|
||||
|> assign(:logged_in, false)
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
defmodule DateFormatter do
|
||||
def format_date(date_string) when is_binary(date_string) do
|
||||
anio = String.slice(date_string, 0..3)
|
||||
mes = String.slice(date_string, 4..5)
|
||||
dia = String.slice(date_string, 6..7)
|
||||
|
||||
"#{dia}/#{mes}/#{anio}"
|
||||
end
|
||||
|
||||
def format_hour(hour_string) when is_binary(hour_string) do
|
||||
hora = String.slice(hour_string, 0..1)
|
||||
minutos = String.slice(hour_string, 2..3)
|
||||
segundos = String.slice(hour_string, 4..6)
|
||||
|
||||
"#{hora}:#{minutos}:#{segundos}"
|
||||
end
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<%= if @logged_in == false do %>
|
||||
<div class="log_in_container">
|
||||
<form class="log_in_form" phx-submit="login">
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="Sanatorio Americano Logo"/>
|
||||
<input class="imput_text" type="text" name="dni" placeholder="ID Paciente"/>
|
||||
<input class="submit_button" type="submit" value="Ingresar" id="submit">
|
||||
<%= if @dato_incorrecto == true do %>
|
||||
<h1 class="error_msg">Datos incorrectos</h1>
|
||||
<% end %>
|
||||
</form>
|
||||
<div class="info_panel">
|
||||
<p style="text-align: center;">Bienvenido a Entrega Digital <br> <b>Sanatorio Americano.</b></p>
|
||||
<br>
|
||||
<p> En este sitio, usted podrá visualizar los informes y estudios realizados en nuestra institución.</p>
|
||||
<br>
|
||||
<p>Si presenta inconvenientes con los datos ingresados, puede comunicarse con nosotros enviando un correo a
|
||||
<br>
|
||||
<b>mesadeayuda@sanatorio-americano.com.ar</b> detallando su nombre completo y D.N.I.</p>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="pantalla_estudios_header">
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="IM LOGO"/>
|
||||
</div>
|
||||
<%= if length(@studies) > 0 do %>
|
||||
<div class="estudio_patientname">
|
||||
<h1><%= List.first(@studies).lastname %>, <%= List.first(@studies).patientname %></h1>
|
||||
<p>Para ver su estudio haga click en Abrir.</p>
|
||||
</div>
|
||||
<div class="estudio_container">
|
||||
<div class="estudio_details">
|
||||
<p>Estudios</p>
|
||||
</div>
|
||||
<div class="estudio_icons">
|
||||
<p>Informe</p>
|
||||
<p>Imágenes</p>
|
||||
</div>
|
||||
</div>
|
||||
<%= for study <- @studies do %>
|
||||
<div class="estudio_container">
|
||||
<div class="estudio_details">
|
||||
<p><b>Fecha y hora:</b> <%= DateFormatter.format_date(study.fecha) %> - <%= DateFormatter.format_hour(study.hora) %></p>
|
||||
<p><b>Estudio:</b> <%= study.desc %></p>
|
||||
<p><b>DNI:</b> <%= study.dni %></p>
|
||||
<p><b>Accession N°</b> <%= study.accession %></p>
|
||||
</div>
|
||||
<div class="estudio_icons">
|
||||
<%= case {study.modality, study.esteco, study.estrx} do %>
|
||||
<% {"US", "F", _} -> %>
|
||||
<i class="fa-regular fa-file-lines fa-3x" style="color: #297177"></i>
|
||||
<% {modality, _, "E"} when modality != "US" -> %>
|
||||
<i class="fa-regular fa-file-lines fa-3x" style="color: #297177"></i>
|
||||
<% _ -> %>
|
||||
<i class="fa-solid fa-file-circle-question fa-3x" style="color: #DCDCDC"></i>
|
||||
<% end %>
|
||||
<%= if study.modality != "US" do %>
|
||||
<i class="fa-solid fa-file-circle-check fa-3x" style="color: #297177"></i>
|
||||
<% else %>
|
||||
<i class="fa-solid fa-file-circle-question fa-3x" style="color: #DCDCDC"></i>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
"""
|
||||
end
|
||||
|
||||
|
||||
def handle_event("login", %{"dni" => dni, "acc" => acc}, socket) do
|
||||
IO.inspect(dni)
|
||||
IO.inspect(acc)
|
||||
query = from vl in "V_LISTAINGRESOS",
|
||||
select: %{
|
||||
idstudy: field(vl, :ID)
|
||||
},
|
||||
where: field(vl, :TIPO_DOCUMENTO) == ^dni
|
||||
and field(vl, :ACCESSIONNUMBER) == ^acc
|
||||
|
||||
result = Derivantes.TdsRepo.all(query)
|
||||
|
||||
socket = case result do
|
||||
[] -> socket
|
||||
|> assign(:dato_incorrecto, true)
|
||||
_ -> query = from vl in "V_LISTAINGRESOS",
|
||||
select: %{
|
||||
idstudy: field(vl, :ID),
|
||||
estrx: field(vl, :ESTRX),
|
||||
esteco: field(vl, :ESTECO),
|
||||
desc: field(vl, :PROD_DESC),
|
||||
hora: field(vl, :START_TIME),
|
||||
fecha: field(vl, :START_DATE),
|
||||
modality: field(vl, :MODALITY),
|
||||
dni: field(vl, :TIPO_DOCUMENTO),
|
||||
lastname: field(vl, :PATIENTLASTNAME),
|
||||
accession: field(vl, :ACCESSIONNUMBER),
|
||||
patientname: field(vl, :PATIENTFIRSTNAME)
|
||||
},
|
||||
where: field(vl, :TIPO_DOCUMENTO) == ^dni,
|
||||
order_by: [desc: field(vl, :START_DATE)]
|
||||
|
||||
IO.inspect(query, label: "----> Query")
|
||||
estudios = Derivantes.TdsRepo.all(query)
|
||||
socket
|
||||
|> assign(dni: dni)
|
||||
|> assign(acc: acc)
|
||||
|> assign(logged_in: true)
|
||||
|> assign(studies: estudios)
|
||||
|> assign(dato_incorrecto: false)
|
||||
end
|
||||
{:noreply, socket}
|
||||
end
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
defmodule DerivantesWeb.LoginLive.Index 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
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
<h1>
|
||||
Hola mundo
|
||||
</h1>
|
@ -1,26 +0,0 @@
|
||||
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
|
@ -21,8 +21,8 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLive do
|
||||
</.simple_form>
|
||||
|
||||
<p class="text-center mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Register</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Log in</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
@ -36,7 +36,7 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLive do
|
||||
if user = Accounts.get_user_by_email(email) do
|
||||
Accounts.deliver_user_confirmation_instructions(
|
||||
user,
|
||||
&url(~p"/users/confirm/#{&1}")
|
||||
&url(~p"/derivantes/confirm/#{&1}")
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -6,18 +6,18 @@ defmodule DerivantesWeb.UserConfirmationLive do
|
||||
def render(%{live_action: :edit} = assigns) do
|
||||
~H"""
|
||||
<div class="mx-auto max-w-sm">
|
||||
<.header class="text-center">Confirm Account</.header>
|
||||
<.header class="text-center">Confirmar Cuenta</.header>
|
||||
|
||||
<.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account">
|
||||
<input type="hidden" name={@form[:token].name} value={@form[:token].value} />
|
||||
<:actions>
|
||||
<.button phx-disable-with="Confirming..." class="w-full">Confirm my account</.button>
|
||||
<.button phx-disable-with="Confirmando..." class="w-full">Confirmar mi cuenta</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
|
||||
<p class="text-center mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Registrarse</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Ingresar</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
|
@ -20,8 +20,8 @@ defmodule DerivantesWeb.UserForgotPasswordLive do
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
<p class="text-center text-sm mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Register</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Log in</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
@ -35,7 +35,7 @@ defmodule DerivantesWeb.UserForgotPasswordLive do
|
||||
if user = Accounts.get_user_by_email(email) do
|
||||
Accounts.deliver_user_reset_password_instructions(
|
||||
user,
|
||||
&url(~p"/users/reset_password/#{&1}")
|
||||
&url(~p"/derivantes/reset_password/#{&1}")
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -3,31 +3,50 @@ defmodule DerivantesWeb.UserLoginLive do
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<div class="mx-auto max-w-sm">
|
||||
<div class="max-w-sm flex justify-center flex-col m-auto">
|
||||
<.header class="text-center">
|
||||
Log in to account
|
||||
Entra en su cuenta
|
||||
<:subtitle>
|
||||
Don't have an account?
|
||||
<.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline">
|
||||
Sign up
|
||||
No tiene una?
|
||||
<.link navigate={~p"/derivantes/register"} class="font-semibold text-[#297177] hover:underline">
|
||||
Registre y active
|
||||
</.link>
|
||||
for an account now.
|
||||
su cuenta ahora.
|
||||
</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.simple_form for={@form} id="login_form" action={~p"/users/log_in"} phx-update="ignore">
|
||||
<.input field={@form[:email]} type="email" label="Email" required />
|
||||
<.input field={@form[:password]} type="password" label="Password" required />
|
||||
<.simple_form
|
||||
for={@form}
|
||||
id="login_form"
|
||||
action={~p"/derivantes/log_in"}
|
||||
phx-update="ignore"
|
||||
class="auth_form"
|
||||
>
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="Sanatorio Americano Logo"/>
|
||||
<.input
|
||||
field={@form[:email]}
|
||||
type="email"
|
||||
label="Email"
|
||||
class="imput_text"
|
||||
required
|
||||
/>
|
||||
<.input
|
||||
field={@form[:password]}
|
||||
type="password"
|
||||
label="Contraseña"
|
||||
class="imput_text"
|
||||
required
|
||||
/>
|
||||
|
||||
<:actions>
|
||||
<.input field={@form[:remember_me]} type="checkbox" label="Keep me logged in" />
|
||||
<.link href={~p"/users/reset_password"} class="text-sm font-semibold">
|
||||
Forgot your password?
|
||||
<.input field={@form[:remember_me]} type="checkbox" label="Mantenerme conectado" class="accent-[#297177]"/>
|
||||
<.link href={~p"/derivantes/reset_password"} class="text-sm text-white font-semibold">
|
||||
Olvidó su contraseña?
|
||||
</.link>
|
||||
</:actions>
|
||||
<:actions>
|
||||
<.button phx-disable-with="Logging in..." class="w-full">
|
||||
Log in <span aria-hidden="true">→</span>
|
||||
<.button phx-disable-with="Entrando..." class="w-full submit_button">
|
||||
Entrar <span aria-hidden="true">→</span>
|
||||
</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
|
@ -8,13 +8,13 @@ defmodule DerivantesWeb.UserRegistrationLive do
|
||||
~H"""
|
||||
<div class="mx-auto max-w-sm">
|
||||
<.header class="text-center">
|
||||
Register for an account
|
||||
Registre su nueva cuenta
|
||||
<:subtitle>
|
||||
Already registered?
|
||||
<.link navigate={~p"/users/log_in"} class="font-semibold text-brand hover:underline">
|
||||
Log in
|
||||
Ya tiene una cuenta?
|
||||
<.link navigate={~p"/derivantes/log_in"} class="font-semibold text-[#297177] hover:underline">
|
||||
Entre
|
||||
</.link>
|
||||
to your account now.
|
||||
a su cuenta ahora.
|
||||
</:subtitle>
|
||||
</.header>
|
||||
|
||||
@ -24,18 +24,19 @@ defmodule DerivantesWeb.UserRegistrationLive do
|
||||
phx-submit="save"
|
||||
phx-change="validate"
|
||||
phx-trigger-action={@trigger_submit}
|
||||
action={~p"/users/log_in?_action=registered"}
|
||||
action={~p"/derivantes/log_in?_action=registered"}
|
||||
method="post"
|
||||
class="auth_form"
|
||||
>
|
||||
<.error :if={@check_errors}>
|
||||
Oops, something went wrong! Please check the errors below.
|
||||
Hubo un error.
|
||||
</.error>
|
||||
|
||||
<.input field={@form[:email]} type="email" label="Email" required />
|
||||
<.input field={@form[:password]} type="password" label="Password" required />
|
||||
<img src={~p"/images/sana_americano_logo.png"} alt="Sanatorio Americano Logo"/>
|
||||
<.input class="imput_text w-40" field={@form[:email]} type="email" label="Email" required />
|
||||
<.input class="imput_text w-40" field={@form[:password]} type="password" label="Contraseña" required />
|
||||
|
||||
<:actions>
|
||||
<.button phx-disable-with="Creating account..." class="w-full">Create an account</.button>
|
||||
<.button phx-disable-with="Creating account..." class="submit_button">Create an account</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
</div>
|
||||
@ -59,7 +60,7 @@ defmodule DerivantesWeb.UserRegistrationLive do
|
||||
{:ok, _} =
|
||||
Accounts.deliver_user_confirmation_instructions(
|
||||
user,
|
||||
&url(~p"/users/confirm/#{&1}")
|
||||
&url(~p"/derivantes/confirm/#{&1}")
|
||||
)
|
||||
|
||||
changeset = Accounts.change_user_registration(user)
|
||||
|
@ -31,8 +31,8 @@ defmodule DerivantesWeb.UserResetPasswordLive do
|
||||
</.simple_form>
|
||||
|
||||
<p class="text-center text-sm mt-4">
|
||||
<.link href={~p"/users/register"}>Register</.link>
|
||||
| <.link href={~p"/users/log_in"}>Log in</.link>
|
||||
<.link href={~p"/derivantes/register"}>Register</.link>
|
||||
| <.link href={~p"/derivantes/log_in"}>Log in</.link>
|
||||
</p>
|
||||
</div>
|
||||
"""
|
||||
@ -61,7 +61,7 @@ defmodule DerivantesWeb.UserResetPasswordLive do
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Password reset successfully.")
|
||||
|> redirect(to: ~p"/users/log_in")}
|
||||
|> redirect(to: ~p"/derivantes/log_in")}
|
||||
|
||||
{:error, changeset} ->
|
||||
{:noreply, assign_form(socket, Map.put(changeset, :action, :insert))}
|
||||
|
@ -37,7 +37,7 @@ defmodule DerivantesWeb.UserSettingsLive do
|
||||
<.simple_form
|
||||
for={@password_form}
|
||||
id="password_form"
|
||||
action={~p"/users/log_in?_action=password_updated"}
|
||||
action={~p"/derivantes/log_in?_action=password_updated"}
|
||||
method="post"
|
||||
phx-change="validate_password"
|
||||
phx-submit="update_password"
|
||||
@ -83,7 +83,7 @@ defmodule DerivantesWeb.UserSettingsLive do
|
||||
put_flash(socket, :error, "Email change link is invalid or it has expired.")
|
||||
end
|
||||
|
||||
{:ok, push_navigate(socket, to: ~p"/users/settings")}
|
||||
{:ok, push_navigate(socket, to: ~p"/derivantes/settings")}
|
||||
end
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
@ -124,7 +124,7 @@ defmodule DerivantesWeb.UserSettingsLive do
|
||||
Accounts.deliver_user_update_email_instructions(
|
||||
applied_user,
|
||||
user.email,
|
||||
&url(~p"/users/settings/confirm_email/#{&1}")
|
||||
&url(~p"/derivantes/settings/confirm_email/#{&1}")
|
||||
)
|
||||
|
||||
info = "A link to confirm your email change has been sent to the new address."
|
||||
|
@ -53,13 +53,13 @@ defmodule DerivantesWeb.Router do
|
||||
|
||||
live_session :redirect_if_user_is_authenticated,
|
||||
on_mount: [{DerivantesWeb.UserAuth, :redirect_if_user_is_authenticated}] do
|
||||
live "/users/register", UserRegistrationLive, :new
|
||||
live "/users/log_in", UserLoginLive, :new
|
||||
live "/users/reset_password", UserForgotPasswordLive, :new
|
||||
live "/users/reset_password/:token", UserResetPasswordLive, :edit
|
||||
live "/derivantes/register", UserRegistrationLive, :new
|
||||
live "/derivantes/log_in", UserLoginLive, :new
|
||||
live "/derivantes/reset_password", UserForgotPasswordLive, :new
|
||||
live "/derivantes/reset_password/:token", UserResetPasswordLive, :edit
|
||||
end
|
||||
|
||||
post "/users/log_in", UserSessionController, :create
|
||||
post "/derivantes/log_in", UserSessionController, :create
|
||||
end
|
||||
|
||||
scope "/", DerivantesWeb do
|
||||
@ -67,8 +67,8 @@ defmodule DerivantesWeb.Router do
|
||||
|
||||
live_session :require_authenticated_user,
|
||||
on_mount: [{DerivantesWeb.UserAuth, :ensure_authenticated}] do
|
||||
live "/users/settings", UserSettingsLive, :edit
|
||||
live "/users/settings/confirm_email/:token", UserSettingsLive, :confirm_email
|
||||
live "/derivantes/settings", UserSettingsLive, :edit
|
||||
live "/derivantes/settings/confirm_email/:token", UserSettingsLive, :confirm_email
|
||||
end
|
||||
end
|
||||
|
||||
@ -76,21 +76,21 @@ defmodule DerivantesWeb.Router do
|
||||
pipe_through [:browser, :require_confirmed_user]
|
||||
|
||||
live_session :require_confirmed_user,
|
||||
on_mount: [{DerivantesWeb.UserAuth, :ensure_authentcated}] do
|
||||
live "/test", TestLive, :index
|
||||
on_mount: [{DerivantesWeb.UserAuth, :ensure_authenticated}] do
|
||||
live "/derivantes", DerivantesLive
|
||||
live "/derivantes/:hash", DerivantesHashLive
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scope "/", DerivantesWeb do
|
||||
pipe_through [:browser]
|
||||
|
||||
delete "/users/log_out", UserSessionController, :delete
|
||||
delete "/derivantes/log_out", UserSessionController, :delete
|
||||
|
||||
live_session :current_user,
|
||||
on_mount: [{DerivantesWeb.UserAuth, :mount_current_user}] do
|
||||
live "/users/confirm/:token", UserConfirmationLive, :edit
|
||||
live "/users/confirm", UserConfirmationInstructionsLive, :new
|
||||
live "/derivantes/confirm/:token", UserConfirmationLive, :edit
|
||||
live "/derivantes/confirm", UserConfirmationInstructionsLive, :new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -158,7 +158,7 @@ defmodule DerivantesWeb.UserAuth do
|
||||
socket =
|
||||
socket
|
||||
|> Phoenix.LiveView.put_flash(:error, "You must log in to access this page.")
|
||||
|> Phoenix.LiveView.redirect(to: ~p"/users/log_in")
|
||||
|> Phoenix.LiveView.redirect(to: ~p"/derivantes/log_in")
|
||||
|
||||
{:halt, socket}
|
||||
end
|
||||
@ -209,23 +209,23 @@ defmodule DerivantesWeb.UserAuth do
|
||||
conn
|
||||
|> put_flash(:error, "You must log in to access this page.")
|
||||
|> maybe_store_return_to()
|
||||
|> redirect(to: ~p"/users/log_in")
|
||||
|> redirect(to: ~p"/derivantes/log_in")
|
||||
|> halt()
|
||||
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")
|
||||
|> redirect(to: ~p"/derivantes/log_in")
|
||||
|> halt()
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
defp put_token_in_session(conn, token) do
|
||||
|
Reference in New Issue
Block a user