rutas cambiadas
This commit is contained in:
		
							
								
								
									
										158
									
								
								assets/css/app.css
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										158
									
								
								assets/css/app.css
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -3,3 +3,161 @@ | ||||
| @import "tailwindcss/utilities"; | ||||
|  | ||||
| /* This file is for your main application CSS */ | ||||
|  | ||||
| body{ | ||||
|     background-color: #eaeaea; | ||||
| } | ||||
|  | ||||
| .log_in_container{ | ||||
|     display: flex; | ||||
|     flex-direction: row; | ||||
|     margin-top: 100px; | ||||
|     width: 70%; | ||||
|     margin-left: auto; | ||||
|     margin-right: auto; | ||||
| } | ||||
|  | ||||
| .log_in_form{ | ||||
|     background-color: #297177; | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|     align-items: center; | ||||
|     margin-right: 100px; | ||||
|     border-radius: 5px; | ||||
|     padding: 15px; | ||||
|     height: max-content; | ||||
| } | ||||
|  | ||||
| .auth_form{ | ||||
|     background-color: #297177; | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|     align-items: center; | ||||
|     border-radius: 5px; | ||||
|     padding: 15px; | ||||
|     height: max-content; | ||||
| } | ||||
|  | ||||
| .auth_form img{ | ||||
|     margin-top: 10px; | ||||
|     margin-bottom: 20px; | ||||
|     width: 200px; | ||||
| } | ||||
|  | ||||
| .log_in_form img{ | ||||
|     margin-top: 10px; | ||||
|     margin-bottom: 20px; | ||||
|     width: 200px; | ||||
| } | ||||
|  | ||||
| .imput_text{ | ||||
|     margin-top: 5px; | ||||
|     border-radius: 5px; | ||||
| } | ||||
|  | ||||
| .submit_button{ | ||||
|     background-color: #5bc0de; | ||||
|     color: white; | ||||
|     padding-top: 10px; | ||||
|     padding-bottom: 10px; | ||||
|     width: 205px; | ||||
|     border-radius: 5px; | ||||
|     margin-top: 20px; | ||||
|     font-weight: bold; | ||||
| } | ||||
|  | ||||
| .info_panel{ | ||||
|     background-color: #a0cfd2; | ||||
|     padding: 30px; | ||||
|     border-radius: 5px; | ||||
| } | ||||
|  | ||||
| .error_msg{ | ||||
|     color: red; | ||||
|     font-weight: bold; | ||||
|     text-align: center; | ||||
|     margin-top: 15px; | ||||
| } | ||||
|  | ||||
| .pantalla_estudios_header{ | ||||
|     background-color: #297177; | ||||
|     padding: 10px; | ||||
| } | ||||
|  | ||||
| .pantalla_estudios_header img{ | ||||
|     width: 150px; | ||||
|     margin-left: 5px; | ||||
| } | ||||
|  | ||||
| .estudio_patientname{ | ||||
|     margin-left: 20px; | ||||
|     margin-top: 20px; | ||||
|     margin-bottom: 5px;     | ||||
| } | ||||
|  | ||||
| .estudio_patientname h1{ | ||||
|     font-weight: bold; | ||||
|     font-size: 22px; | ||||
|     color: #297177; | ||||
| } | ||||
|  | ||||
| .estudio_patientname p{ | ||||
|     font-size: 12px; | ||||
| } | ||||
|  | ||||
| .estudio_container{ | ||||
|     margin-left: 20px; | ||||
|     margin-right: 20px; | ||||
|     border-top: dotted black 1px; | ||||
|     background-color: white; | ||||
|     font-size: 12px; | ||||
|     padding: 5px; | ||||
|     padding-left: 10px; | ||||
|     display: flex; | ||||
|     flex-direction: row; | ||||
|     justify-content: space-between; | ||||
|     align-items: center; | ||||
| } | ||||
|  | ||||
| .estudio_details{ | ||||
|     width: 70%; | ||||
| } | ||||
|  | ||||
| .estudio_icons{ | ||||
|     width: 30%; | ||||
|     display: flex; | ||||
|     justify-content: space-evenly; | ||||
| } | ||||
|  | ||||
| .im_footer{ | ||||
|     display: flex; | ||||
|     flex-direction: row; | ||||
|     justify-content: flex-start; | ||||
|     align-items: center; | ||||
|     text-align: end; | ||||
|     padding-top: 40px; | ||||
|     padding-left: 20px; | ||||
|     padding-bottom: 20px; | ||||
|     font-size: 12px; | ||||
|     line-height: 15px; | ||||
| } | ||||
|  | ||||
| .im_footer p{ | ||||
|     margin-right: 20px; | ||||
| } | ||||
|  | ||||
| .im_footer img{ | ||||
|     width: 140px; | ||||
| } | ||||
|  | ||||
| @media (min-width: 1250px) { | ||||
|     .log_in_container{ | ||||
|         width: 50%; | ||||
|     } | ||||
|     .estudio_details{ | ||||
|         width: 80%; | ||||
|     } | ||||
|     .estudio_icons{ | ||||
|         width: 20%; | ||||
|     } | ||||
| } | ||||
| @ -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 | ||||
|  | ||||
							
								
								
									
										1
									
								
								mix.exs
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								mix.exs
									
									
									
									
									
								
							| @ -60,6 +60,7 @@ defmodule Derivantes.MixProject do | ||||
|         compile: false, | ||||
|         depth: 1}, | ||||
|       {:tds, ">= 0.0.0"}, | ||||
|       {:tds_encoding, ">= 1.1.1"}, | ||||
|       {:plug_cowboy, "~> 2.5"} | ||||
|     ] | ||||
|   end | ||||
|  | ||||
							
								
								
									
										3
									
								
								mix.lock
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								mix.lock
									
									
									
									
									
								
							| @ -38,12 +38,15 @@ | ||||
|   "plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"}, | ||||
|   "postgrex": {:hex, :postgrex, "0.18.0", "f34664101eaca11ff24481ed4c378492fed2ff416cd9b06c399e90f321867d7e", [: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", "a042989ba1bc1cca7383ebb9e461398e3f89f868c92ce6671feb7ef132a252d1"}, | ||||
|   "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, | ||||
|   "rustler": {:hex, :rustler, "0.22.2", "f92d6dba71bef6fe5f0d955649cb071127adc92f32a78890e8fa9939e59a1b41", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.5.2", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "56b129141e86d60a2d670af9a2b55a9071e10933ef593034565af77e84655118"}, | ||||
|   "swoosh": {:hex, :swoosh, "1.16.7", "9dd0c172b4519a023f58e94d3ea79480b469dd4c0cd5369fabfbfd2e39bf5545", [: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.1.0", [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.4 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21073982816cff3410e90c0d80ebfd5a0bf4839c7b39db20bc69a6df123bbf35"}, | ||||
|   "tailwind": {:hex, :tailwind, "0.2.2", "9e27288b568ede1d88517e8c61259bc214a12d7eed271e102db4c93fcca9b2cd", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "ccfb5025179ea307f7f899d1bb3905cd0ac9f687ed77feebc8f67bdca78565c4"}, | ||||
|   "tds": {:hex, :tds, "2.3.5", "fedfb96d53206f01eac62ead859e47e1541a62e1553e9eb7a8801c7dca59eae8", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 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", "52e350f5dd5584bbcff9859e331be144d290b41bd4c749b936014a17660662f2"}, | ||||
|   "tds_encoding": {:hex, :tds_encoding, "1.1.1", "26f911814766526e89013c98ae7f8412e42c2ff8bd33196ddea1f8bded1714d9", [:mix], [{:rustler, "~> 0.22.0", [hex: :rustler, repo: "hexpm", optional: false]}], "hexpm", "04cf96a93c0799cedd4db8b16c32a94137d912cad0362d567c3bb3d92dddcab3"}, | ||||
|   "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, | ||||
|   "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.2", "2caabe9344ec17eafe5403304771c3539f3b6e2f7fb6a6f602558c825d0d0bfb", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9b43db0dc33863930b9ef9d27137e78974756f5f198cae18409970ed6fa5b561"}, | ||||
|   "telemetry_poller": {:hex, :telemetry_poller, "1.1.0", "58fa7c216257291caaf8d05678c8d01bd45f4bdbc1286838a28c4bb62ef32999", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9eb9d9cbfd81cbd7cdd24682f8711b6e2b691289a0de6826e58452f28c103c8f"}, | ||||
|   "toml": {:hex, :toml, "0.5.2", "e471388a8726d1ce51a6b32f864b8228a1eb8edc907a0edf2bb50eab9321b526", [:mix], [], "hexpm", "f1e3dabef71fb510d015fad18c0e05e7c57281001141504c6b69d94e99750a07"}, | ||||
|   "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"}, | ||||
|   "websock_adapter": {:hex, :websock_adapter, "0.5.6", "0437fe56e093fd4ac422de33bf8fc89f7bc1416a3f2d732d8b2c8fd54792fe60", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "e04378d26b0af627817ae84c92083b7e97aca3121196679b73c73b99d0d133ea"}, | ||||
| } | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								priv/static/images/fondo.jpg
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								priv/static/images/fondo.jpg
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 324 KiB | 
							
								
								
									
										
											BIN
										
									
								
								priv/static/images/logoim.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								priv/static/images/logoim.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 6.3 KiB | 
							
								
								
									
										
											BIN
										
									
								
								priv/static/images/sana_americano_logo.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								priv/static/images/sana_americano_logo.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 8.8 KiB | 
| @ -7,10 +7,10 @@ defmodule DerivantesWeb.UserSessionControllerTest do | ||||
|     %{user: user_fixture()} | ||||
|   end | ||||
|  | ||||
|   describe "POST /users/log_in" do | ||||
|   describe "POST /derivantes/log_in" do | ||||
|     test "logs the user in", %{conn: conn, user: user} do | ||||
|       conn = | ||||
|         post(conn, ~p"/users/log_in", %{ | ||||
|         post(conn, ~p"/derivantes/log_in", %{ | ||||
|           "user" => %{"email" => user.email, "password" => valid_user_password()} | ||||
|         }) | ||||
|  | ||||
| @ -21,13 +21,13 @@ defmodule DerivantesWeb.UserSessionControllerTest do | ||||
|       conn = get(conn, ~p"/") | ||||
|       response = html_response(conn, 200) | ||||
|       assert response =~ user.email | ||||
|       assert response =~ ~p"/users/settings" | ||||
|       assert response =~ ~p"/users/log_out" | ||||
|       assert response =~ ~p"/derivantes/settings" | ||||
|       assert response =~ ~p"/derivantes/log_out" | ||||
|     end | ||||
|  | ||||
|     test "logs the user in with remember me", %{conn: conn, user: user} do | ||||
|       conn = | ||||
|         post(conn, ~p"/users/log_in", %{ | ||||
|         post(conn, ~p"/derivantes/log_in", %{ | ||||
|           "user" => %{ | ||||
|             "email" => user.email, | ||||
|             "password" => valid_user_password(), | ||||
| @ -43,7 +43,7 @@ defmodule DerivantesWeb.UserSessionControllerTest do | ||||
|       conn = | ||||
|         conn | ||||
|         |> init_test_session(user_return_to: "/foo/bar") | ||||
|         |> post(~p"/users/log_in", %{ | ||||
|         |> post(~p"/derivantes/log_in", %{ | ||||
|           "user" => %{ | ||||
|             "email" => user.email, | ||||
|             "password" => valid_user_password() | ||||
| @ -57,7 +57,7 @@ defmodule DerivantesWeb.UserSessionControllerTest do | ||||
|     test "login following registration", %{conn: conn, user: user} do | ||||
|       conn = | ||||
|         conn | ||||
|         |> post(~p"/users/log_in", %{ | ||||
|         |> post(~p"/derivantes/log_in", %{ | ||||
|           "_action" => "registered", | ||||
|           "user" => %{ | ||||
|             "email" => user.email, | ||||
| @ -72,7 +72,7 @@ defmodule DerivantesWeb.UserSessionControllerTest do | ||||
|     test "login following password update", %{conn: conn, user: user} do | ||||
|       conn = | ||||
|         conn | ||||
|         |> post(~p"/users/log_in", %{ | ||||
|         |> post(~p"/derivantes/log_in", %{ | ||||
|           "_action" => "password_updated", | ||||
|           "user" => %{ | ||||
|             "email" => user.email, | ||||
| @ -80,31 +80,31 @@ defmodule DerivantesWeb.UserSessionControllerTest do | ||||
|           } | ||||
|         }) | ||||
|  | ||||
|       assert redirected_to(conn) == ~p"/users/settings" | ||||
|       assert redirected_to(conn) == ~p"/derivantes/settings" | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Password updated successfully" | ||||
|     end | ||||
|  | ||||
|     test "redirects to login page with invalid credentials", %{conn: conn} do | ||||
|       conn = | ||||
|         post(conn, ~p"/users/log_in", %{ | ||||
|         post(conn, ~p"/derivantes/log_in", %{ | ||||
|           "user" => %{"email" => "invalid@email.com", "password" => "invalid_password"} | ||||
|         }) | ||||
|  | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :error) == "Invalid email or password" | ||||
|       assert redirected_to(conn) == ~p"/users/log_in" | ||||
|       assert redirected_to(conn) == ~p"/derivantes/log_in" | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   describe "DELETE /users/log_out" do | ||||
|   describe "DELETE /derivantes/log_out" do | ||||
|     test "logs the user out", %{conn: conn, user: user} do | ||||
|       conn = conn |> log_in_user(user) |> delete(~p"/users/log_out") | ||||
|       conn = conn |> log_in_user(user) |> delete(~p"/derivantes/log_out") | ||||
|       assert redirected_to(conn) == ~p"/" | ||||
|       refute get_session(conn, :user_token) | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Logged out successfully" | ||||
|     end | ||||
|  | ||||
|     test "succeeds even if the user is not logged in", %{conn: conn} do | ||||
|       conn = delete(conn, ~p"/users/log_out") | ||||
|       conn = delete(conn, ~p"/derivantes/log_out") | ||||
|       assert redirected_to(conn) == ~p"/" | ||||
|       refute get_session(conn, :user_token) | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Logged out successfully" | ||||
|  | ||||
| @ -13,12 +13,12 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLiveTest do | ||||
|  | ||||
|   describe "Resend confirmation" do | ||||
|     test "renders the resend confirmation page", %{conn: conn} do | ||||
|       {:ok, _lv, html} = live(conn, ~p"/users/confirm") | ||||
|       {:ok, _lv, html} = live(conn, ~p"/derivantes/confirm") | ||||
|       assert html =~ "Resend confirmation instructions" | ||||
|     end | ||||
|  | ||||
|     test "sends a new confirmation token", %{conn: conn, user: user} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
| @ -35,7 +35,7 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLiveTest do | ||||
|     test "does not send confirmation token if user is confirmed", %{conn: conn, user: user} do | ||||
|       Repo.update!(Accounts.User.confirm_changeset(user)) | ||||
|  | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
| @ -50,7 +50,7 @@ defmodule DerivantesWeb.UserConfirmationInstructionsLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "does not send confirmation token if email is invalid", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
|  | ||||
| @ -13,7 +13,7 @@ defmodule DerivantesWeb.UserConfirmationLiveTest do | ||||
|  | ||||
|   describe "Confirm user" do | ||||
|     test "renders confirmation page", %{conn: conn} do | ||||
|       {:ok, _lv, html} = live(conn, ~p"/users/confirm/some-token") | ||||
|       {:ok, _lv, html} = live(conn, ~p"/derivantes/confirm/some-token") | ||||
|       assert html =~ "Confirm Account" | ||||
|     end | ||||
|  | ||||
| @ -23,7 +23,7 @@ defmodule DerivantesWeb.UserConfirmationLiveTest do | ||||
|           Accounts.deliver_user_confirmation_instructions(user, url) | ||||
|         end) | ||||
|  | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm/#{token}") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -41,7 +41,7 @@ defmodule DerivantesWeb.UserConfirmationLiveTest do | ||||
|       assert Repo.all(Accounts.UserToken) == [] | ||||
|  | ||||
|       # when not logged in | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm/#{token}") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -59,7 +59,7 @@ defmodule DerivantesWeb.UserConfirmationLiveTest do | ||||
|         build_conn() | ||||
|         |> log_in_user(user) | ||||
|  | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm/#{token}") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -72,7 +72,7 @@ defmodule DerivantesWeb.UserConfirmationLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "does not confirm email with invalid token", %{conn: conn, user: user} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/confirm/invalid-token") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/confirm/invalid-token") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
|  | ||||
| @ -9,18 +9,18 @@ defmodule DerivantesWeb.UserForgotPasswordLiveTest do | ||||
|  | ||||
|   describe "Forgot password page" do | ||||
|     test "renders email page", %{conn: conn} do | ||||
|       {:ok, lv, html} = live(conn, ~p"/users/reset_password") | ||||
|       {:ok, lv, html} = live(conn, ~p"/derivantes/reset_password") | ||||
|  | ||||
|       assert html =~ "Forgot your password?" | ||||
|       assert has_element?(lv, ~s|a[href="#{~p"/users/register"}"]|, "Register") | ||||
|       assert has_element?(lv, ~s|a[href="#{~p"/users/log_in"}"]|, "Log in") | ||||
|       assert has_element?(lv, ~s|a[href="#{~p"/derivantes/register"}"]|, "Register") | ||||
|       assert has_element?(lv, ~s|a[href="#{~p"/derivantes/log_in"}"]|, "Log in") | ||||
|     end | ||||
|  | ||||
|     test "redirects if already logged in", %{conn: conn} do | ||||
|       result = | ||||
|         conn | ||||
|         |> log_in_user(user_fixture()) | ||||
|         |> live(~p"/users/reset_password") | ||||
|         |> live(~p"/derivantes/reset_password") | ||||
|         |> follow_redirect(conn, ~p"/") | ||||
|  | ||||
|       assert {:ok, _conn} = result | ||||
| @ -33,7 +33,7 @@ defmodule DerivantesWeb.UserForgotPasswordLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "sends a new reset password token", %{conn: conn, user: user} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
| @ -48,7 +48,7 @@ defmodule DerivantesWeb.UserForgotPasswordLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "does not send reset password token if email is invalid", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
|  | ||||
| @ -6,7 +6,7 @@ defmodule DerivantesWeb.UserLoginLiveTest do | ||||
|  | ||||
|   describe "Log in page" do | ||||
|     test "renders log in page", %{conn: conn} do | ||||
|       {:ok, _lv, html} = live(conn, ~p"/users/log_in") | ||||
|       {:ok, _lv, html} = live(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       assert html =~ "Log in" | ||||
|       assert html =~ "Register" | ||||
| @ -17,7 +17,7 @@ defmodule DerivantesWeb.UserLoginLiveTest do | ||||
|       result = | ||||
|         conn | ||||
|         |> log_in_user(user_fixture()) | ||||
|         |> live(~p"/users/log_in") | ||||
|         |> live(~p"/derivantes/log_in") | ||||
|         |> follow_redirect(conn, "/") | ||||
|  | ||||
|       assert {:ok, _conn} = result | ||||
| @ -29,7 +29,7 @@ defmodule DerivantesWeb.UserLoginLiveTest do | ||||
|       password = "123456789abcd" | ||||
|       user = user_fixture(%{password: password}) | ||||
|  | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/log_in") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       form = | ||||
|         form(lv, "#login_form", user: %{email: user.email, password: password, remember_me: true}) | ||||
| @ -42,7 +42,7 @@ defmodule DerivantesWeb.UserLoginLiveTest do | ||||
|     test "redirects to login page with a flash error if there are no valid credentials", %{ | ||||
|       conn: conn | ||||
|     } do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/log_in") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       form = | ||||
|         form(lv, "#login_form", | ||||
| @ -53,19 +53,19 @@ defmodule DerivantesWeb.UserLoginLiveTest do | ||||
|  | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :error) == "Invalid email or password" | ||||
|  | ||||
|       assert redirected_to(conn) == "/users/log_in" | ||||
|       assert redirected_to(conn) == "/derivantes/log_in" | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   describe "login navigation" do | ||||
|     test "redirects to registration page when the Register button is clicked", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/log_in") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       {:ok, _login_live, login_html} = | ||||
|         lv | ||||
|         |> element(~s|main a:fl-contains("Sign up")|) | ||||
|         |> render_click() | ||||
|         |> follow_redirect(conn, ~p"/users/register") | ||||
|         |> follow_redirect(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       assert login_html =~ "Register" | ||||
|     end | ||||
| @ -73,13 +73,13 @@ defmodule DerivantesWeb.UserLoginLiveTest do | ||||
|     test "redirects to forgot password page when the Forgot Password button is clicked", %{ | ||||
|       conn: conn | ||||
|     } do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/log_in") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
|         |> element(~s|main a:fl-contains("Forgot your password?")|) | ||||
|         |> render_click() | ||||
|         |> follow_redirect(conn, ~p"/users/reset_password") | ||||
|         |> follow_redirect(conn, ~p"/derivantes/reset_password") | ||||
|  | ||||
|       assert conn.resp_body =~ "Forgot your password?" | ||||
|     end | ||||
|  | ||||
| @ -6,7 +6,7 @@ defmodule DerivantesWeb.UserRegistrationLiveTest do | ||||
|  | ||||
|   describe "Registration page" do | ||||
|     test "renders registration page", %{conn: conn} do | ||||
|       {:ok, _lv, html} = live(conn, ~p"/users/register") | ||||
|       {:ok, _lv, html} = live(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       assert html =~ "Register" | ||||
|       assert html =~ "Log in" | ||||
| @ -16,14 +16,14 @@ defmodule DerivantesWeb.UserRegistrationLiveTest do | ||||
|       result = | ||||
|         conn | ||||
|         |> log_in_user(user_fixture()) | ||||
|         |> live(~p"/users/register") | ||||
|         |> live(~p"/derivantes/register") | ||||
|         |> follow_redirect(conn, "/") | ||||
|  | ||||
|       assert {:ok, _conn} = result | ||||
|     end | ||||
|  | ||||
|     test "renders errors for invalid data", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/register") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -38,7 +38,7 @@ defmodule DerivantesWeb.UserRegistrationLiveTest do | ||||
|  | ||||
|   describe "register user" do | ||||
|     test "creates account and logs the user in", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/register") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       email = unique_user_email() | ||||
|       form = form(lv, "#registration_form", user: valid_user_attributes(email: email)) | ||||
| @ -56,7 +56,7 @@ defmodule DerivantesWeb.UserRegistrationLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "renders errors for duplicated email", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/register") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       user = user_fixture(%{email: "test@email.com"}) | ||||
|  | ||||
| @ -73,13 +73,13 @@ defmodule DerivantesWeb.UserRegistrationLiveTest do | ||||
|  | ||||
|   describe "registration navigation" do | ||||
|     test "redirects to login page when the Log in button is clicked", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/register") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       {:ok, _login_live, login_html} = | ||||
|         lv | ||||
|         |> element(~s|main a:fl-contains("Log in")|) | ||||
|         |> render_click() | ||||
|         |> follow_redirect(conn, ~p"/users/log_in") | ||||
|         |> follow_redirect(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       assert login_html =~ "Log in" | ||||
|     end | ||||
|  | ||||
| @ -19,13 +19,13 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|  | ||||
|   describe "Reset password page" do | ||||
|     test "renders reset password with valid token", %{conn: conn, token: token} do | ||||
|       {:ok, _lv, html} = live(conn, ~p"/users/reset_password/#{token}") | ||||
|       {:ok, _lv, html} = live(conn, ~p"/derivantes/reset_password/#{token}") | ||||
|  | ||||
|       assert html =~ "Reset Password" | ||||
|     end | ||||
|  | ||||
|     test "does not render reset password with invalid token", %{conn: conn} do | ||||
|       {:error, {:redirect, to}} = live(conn, ~p"/users/reset_password/invalid") | ||||
|       {:error, {:redirect, to}} = live(conn, ~p"/derivantes/reset_password/invalid") | ||||
|  | ||||
|       assert to == %{ | ||||
|                flash: %{"error" => "Reset password link is invalid or it has expired."}, | ||||
| @ -34,7 +34,7 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "renders errors for invalid data", %{conn: conn, token: token} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password/#{token}") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -50,7 +50,7 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|  | ||||
|   describe "Reset Password" do | ||||
|     test "resets password once", %{conn: conn, token: token, user: user} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password/#{token}") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
| @ -61,7 +61,7 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|           } | ||||
|         ) | ||||
|         |> render_submit() | ||||
|         |> follow_redirect(conn, ~p"/users/log_in") | ||||
|         |> follow_redirect(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       refute get_session(conn, :user_token) | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Password reset successfully" | ||||
| @ -69,7 +69,7 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "does not reset password on invalid data", %{conn: conn, token: token} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password/#{token}") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -89,13 +89,13 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|  | ||||
|   describe "Reset password navigation" do | ||||
|     test "redirects to login page when the Log in button is clicked", %{conn: conn, token: token} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password/#{token}") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
|         |> element(~s|main a:fl-contains("Log in")|) | ||||
|         |> render_click() | ||||
|         |> follow_redirect(conn, ~p"/users/log_in") | ||||
|         |> follow_redirect(conn, ~p"/derivantes/log_in") | ||||
|  | ||||
|       assert conn.resp_body =~ "Log in" | ||||
|     end | ||||
| @ -104,13 +104,13 @@ defmodule DerivantesWeb.UserResetPasswordLiveTest do | ||||
|       conn: conn, | ||||
|       token: token | ||||
|     } do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/reset_password/#{token}") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/reset_password/#{token}") | ||||
|  | ||||
|       {:ok, conn} = | ||||
|         lv | ||||
|         |> element(~s|main a:fl-contains("Register")|) | ||||
|         |> render_click() | ||||
|         |> follow_redirect(conn, ~p"/users/register") | ||||
|         |> follow_redirect(conn, ~p"/derivantes/register") | ||||
|  | ||||
|       assert conn.resp_body =~ "Register" | ||||
|     end | ||||
|  | ||||
| @ -10,17 +10,17 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|       {:ok, _lv, html} = | ||||
|         conn | ||||
|         |> log_in_user(user_fixture()) | ||||
|         |> live(~p"/users/settings") | ||||
|         |> live(~p"/derivantes/settings") | ||||
|  | ||||
|       assert html =~ "Change Email" | ||||
|       assert html =~ "Change Password" | ||||
|     end | ||||
|  | ||||
|     test "redirects if user is not logged in", %{conn: conn} do | ||||
|       assert {:error, redirect} = live(conn, ~p"/users/settings") | ||||
|       assert {:error, redirect} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       assert {:redirect, %{to: path, flash: flash}} = redirect | ||||
|       assert path == ~p"/users/log_in" | ||||
|       assert path == ~p"/derivantes/log_in" | ||||
|       assert %{"error" => "You must log in to access this page."} = flash | ||||
|     end | ||||
|   end | ||||
| @ -35,7 +35,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     test "updates the user email", %{conn: conn, password: password, user: user} do | ||||
|       new_email = unique_user_email() | ||||
|  | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/settings") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -50,7 +50,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "renders errors with invalid data (phx-change)", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/settings") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -66,7 +66,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "renders errors with invalid data (phx-submit)", %{conn: conn, user: user} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/settings") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -92,7 +92,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     test "updates the user password", %{conn: conn, user: user, password: password} do | ||||
|       new_password = valid_user_password() | ||||
|  | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/settings") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       form = | ||||
|         form(lv, "#password_form", %{ | ||||
| @ -108,7 +108,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|  | ||||
|       new_password_conn = follow_trigger_action(form, conn) | ||||
|  | ||||
|       assert redirected_to(new_password_conn) == ~p"/users/settings" | ||||
|       assert redirected_to(new_password_conn) == ~p"/derivantes/settings" | ||||
|  | ||||
|       assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token) | ||||
|  | ||||
| @ -119,7 +119,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "renders errors with invalid data (phx-change)", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/settings") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -138,7 +138,7 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "renders errors with invalid data (phx-submit)", %{conn: conn} do | ||||
|       {:ok, lv, _html} = live(conn, ~p"/users/settings") | ||||
|       {:ok, lv, _html} = live(conn, ~p"/derivantes/settings") | ||||
|  | ||||
|       result = | ||||
|         lv | ||||
| @ -172,27 +172,27 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|     end | ||||
|  | ||||
|     test "updates the user email once", %{conn: conn, user: user, token: token, email: email} do | ||||
|       {:error, redirect} = live(conn, ~p"/users/settings/confirm_email/#{token}") | ||||
|       {:error, redirect} = live(conn, ~p"/derivantes/settings/confirm_email/#{token}") | ||||
|  | ||||
|       assert {:live_redirect, %{to: path, flash: flash}} = redirect | ||||
|       assert path == ~p"/users/settings" | ||||
|       assert path == ~p"/derivantes/settings" | ||||
|       assert %{"info" => message} = flash | ||||
|       assert message == "Email changed successfully." | ||||
|       refute Accounts.get_user_by_email(user.email) | ||||
|       assert Accounts.get_user_by_email(email) | ||||
|  | ||||
|       # use confirm token again | ||||
|       {:error, redirect} = live(conn, ~p"/users/settings/confirm_email/#{token}") | ||||
|       {:error, redirect} = live(conn, ~p"/derivantes/settings/confirm_email/#{token}") | ||||
|       assert {:live_redirect, %{to: path, flash: flash}} = redirect | ||||
|       assert path == ~p"/users/settings" | ||||
|       assert path == ~p"/derivantes/settings" | ||||
|       assert %{"error" => message} = flash | ||||
|       assert message == "Email change link is invalid or it has expired." | ||||
|     end | ||||
|  | ||||
|     test "does not update email with invalid token", %{conn: conn, user: user} do | ||||
|       {:error, redirect} = live(conn, ~p"/users/settings/confirm_email/oops") | ||||
|       {:error, redirect} = live(conn, ~p"/derivantes/settings/confirm_email/oops") | ||||
|       assert {:live_redirect, %{to: path, flash: flash}} = redirect | ||||
|       assert path == ~p"/users/settings" | ||||
|       assert path == ~p"/derivantes/settings" | ||||
|       assert %{"error" => message} = flash | ||||
|       assert message == "Email change link is invalid or it has expired." | ||||
|       assert Accounts.get_user_by_email(user.email) | ||||
| @ -200,9 +200,9 @@ defmodule DerivantesWeb.UserSettingsLiveTest do | ||||
|  | ||||
|     test "redirects if user is not logged in", %{token: token} do | ||||
|       conn = build_conn() | ||||
|       {:error, redirect} = live(conn, ~p"/users/settings/confirm_email/#{token}") | ||||
|       {:error, redirect} = live(conn, ~p"/derivantes/settings/confirm_email/#{token}") | ||||
|       assert {:redirect, %{to: path, flash: flash}} = redirect | ||||
|       assert path == ~p"/users/log_in" | ||||
|       assert path == ~p"/derivantes/log_in" | ||||
|       assert %{"error" => message} = flash | ||||
|       assert message == "You must log in to access this page." | ||||
|     end | ||||
|  | ||||
| @ -231,7 +231,7 @@ defmodule DerivantesWeb.UserAuthTest do | ||||
|       conn = conn |> fetch_flash() |> UserAuth.require_authenticated_user([]) | ||||
|       assert conn.halted | ||||
|  | ||||
|       assert redirected_to(conn) == ~p"/users/log_in" | ||||
|       assert redirected_to(conn) == ~p"/derivantes/log_in" | ||||
|  | ||||
|       assert Phoenix.Flash.get(conn.assigns.flash, :error) == | ||||
|                "You must log in to access this page." | ||||
|  | ||||
		Reference in New Issue
	
	Block a user