feat(chat): improve user pages layout + redirect

This commit is contained in:
João Paulo Dubas 2025-02-15 22:01:58 +00:00
parent 24b609ec3a
commit 10c905249c
Signed by: joao.dubas
SSH Key Fingerprint: SHA256:V1mixgOGRc/YMhGx/DNkOSmJxgA2vHNrDZEk3wt/kOA
8 changed files with 69 additions and 70 deletions

View File

@ -5,7 +5,7 @@ defmodule SlaxWeb.UserConfirmationInstructionsLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto w-96 mt-16">
<.header class="text-center"> <.header class="text-center">
No confirmation instructions received? No confirmation instructions received?
<:subtitle>We'll send a new confirmation link to your inbox</:subtitle> <:subtitle>We'll send a new confirmation link to your inbox</:subtitle>

View File

@ -5,7 +5,7 @@ defmodule SlaxWeb.UserConfirmationLive do
def render(%{live_action: :edit} = assigns) do def render(%{live_action: :edit} = assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto w-96 mt-16">
<.header class="text-center">Confirm Account</.header> <.header class="text-center">Confirm Account</.header>
<.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account"> <.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account">

View File

@ -5,7 +5,7 @@ defmodule SlaxWeb.UserForgotPasswordLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto w-96 mt-16">
<.header class="text-center"> <.header class="text-center">
Forgot your password? Forgot your password?
<:subtitle>We'll send a password reset link to your inbox</:subtitle> <:subtitle>We'll send a password reset link to your inbox</:subtitle>
@ -45,6 +45,6 @@ defmodule SlaxWeb.UserForgotPasswordLive do
{:noreply, {:noreply,
socket socket
|> put_flash(:info, info) |> put_flash(:info, info)
|> redirect(to: ~p"/")} |> redirect(to: ~p"/users/log_in")}
end end
end end

View File

@ -3,7 +3,7 @@ defmodule SlaxWeb.UserLoginLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto w-96 mt-16">
<.header class="text-center"> <.header class="text-center">
Log in to account Log in to account
<:subtitle> <:subtitle>

View File

@ -6,7 +6,7 @@ defmodule SlaxWeb.UserRegistrationLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto w-96 mt-16">
<.header class="text-center"> <.header class="text-center">
Register for an account Register for an account
<:subtitle> <:subtitle>

View File

@ -5,7 +5,7 @@ defmodule SlaxWeb.UserResetPasswordLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto w-96 mt-16">
<.header class="text-center">Reset Password</.header> <.header class="text-center">Reset Password</.header>
<.simple_form <.simple_form

View File

@ -5,69 +5,68 @@ defmodule SlaxWeb.UserSettingsLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<.header class="text-center"> <div class="mx-auto w-96 mt-16">
Account Settings <.header class="text-center">
<:subtitle>Manage your account email address and password settings</:subtitle> Account Settings
</.header> <:subtitle>Manage your account email address and password settings</:subtitle>
</.header>
<div class="space-y-12 divide-y"> <div class="space-y-12 divide-y">
<div> <div>
<.simple_form <.simple_form
for={@email_form} for={@email_form}
id="email_form" id="email_form"
phx-submit="update_email" phx-submit="update_email"
phx-change="validate_email" phx-change="validate_email"
> >
<.input field={@email_form[:email]} type="email" label="Email" required /> <.input field={@email_form[:email]} type="email" label="Email" required />
<.input <.input
field={@email_form[:current_password]} field={@email_form[:current_password]}
name="current_password" name="current_password"
id="current_password_for_email" id="current_password_for_email"
type="password" type="password"
label="Current password" label="Current password"
value={@email_form_current_password} value={@email_form_current_password}
required />
/> <:actions>
<:actions> <.button phx-disable-with="Changing...">Change Email</.button>
<.button phx-disable-with="Changing...">Change Email</.button> </:actions>
</:actions> </.simple_form>
</.simple_form> </div>
</div> <div>
<div> <.simple_form
<.simple_form for={@password_form}
for={@password_form} id="password_form"
id="password_form" phx-submit="update_password"
action={~p"/users/log_in?_action=password_updated"} phx-change="validate_password"
method="post" phx-trigger-action={@trigger_submit}
phx-change="validate_password" >
phx-submit="update_password" <.input
phx-trigger-action={@trigger_submit} name={@password_form[:email].name}
> type="hidden"
<input id="hidden_user_email"
name={@password_form[:email].name} value={@current_email}
type="hidden" />
id="hidden_user_email" <.input field={@password_form[:password]} type="password" label="New password" required />
value={@current_email} <.input
/> field={@password_form[:password_confirmation]}
<.input field={@password_form[:password]} type="password" label="New password" required /> type="password"
<.input label="Confirm new password"
field={@password_form[:password_confirmation]} />
type="password" <.input
label="Confirm new password" field={@password_form[:current_password]}
/> name="current_password"
<.input type="password"
field={@password_form[:current_password]} label="Current password"
name="current_password" id="current_password_for_password"
type="password" value={@current_password}
label="Current password" required
id="current_password_for_password" />
value={@current_password} <:actions>
required <.button phx-disable-with="Changing...">Change Password</.button>
/> </:actions>
<:actions> </.simple_form>
<.button phx-disable-with="Changing...">Change Password</.button> </div>
</:actions>
</.simple_form>
</div> </div>
</div> </div>
""" """

View File

@ -83,7 +83,7 @@ defmodule SlaxWeb.UserAuth do
conn conn
|> renew_session() |> renew_session()
|> delete_resp_cookie(@remember_me_cookie) |> delete_resp_cookie(@remember_me_cookie)
|> redirect(to: ~p"/") |> redirect(to: ~p"/users/log_in")
end end
@doc """ @doc """