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

View File

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

View File

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

View File

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

View File

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

View File

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