<.settings_tiles> <.tile :if={Plausible.Users.type(@current_user) == :standard} docs="change-email"> <:title> Email address <:subtitle> Change the address associated with your account. <.form :let={f} action={Routes.settings_path(@conn, :update_email)} for={@email_changeset} method="post" > <.input type="text" name="user[current_email]" value={f.data.email} label="Current email" width="w-1/2" mt?={false} disabled /> <.input type="email" field={f[:email]} label="New email" width="w-1/2" /> <.input type="password" field={f[:password]} label="Confirm with password" width="w-1/2" /> <.button type="submit"> Change email <.tile :if={Plausible.Users.type(@current_user) == :sso}> <:title> Email address <:subtitle> Address associated with your account. <.form :let={f} for={@email_changeset}> <.input type="text" name="user[current_email]" value={f.data.email} label="Current email" width="w-1/2" mt?={false} disabled /> <.tile :if={Plausible.Users.type(@current_user) == :standard} docs="reset-password"> <:title> Password <:subtitle> Change your password. <.form :let={f} action={Routes.settings_path(@conn, :update_password)} for={@password_changeset} method="post" > <.input type="password" max_one_error field={f[:old_password]} label="Old password" width="w-1/2" mt?={false} /> <.input type="password" max_one_error field={f[:password]} label="New password" width="w-1/2" /> <.input type="password" max_one_error autocomplete="new-password" field={f[:password_confirmation]} label="Confirm new password" width="w-1/2" />
<.label for={f[:two_factor_code].id} class="mb-2"> Verify with 2FA Code
<.button type="submit"> Change password <.tile docs="2fa"> <:title> Two-Factor Authentication (2FA) <:subtitle> Protect your account by adding an extra security step when you log in.
<.button disabled={Plausible.Users.type(@current_user) == :sso} x-on:click="disable2FAOpen = true; $refs.disable2FAPassword.value = ''" theme="danger" mt?={false} > Disable 2FA

Lost your recovery codes? Generate new

<.form action={Routes.auth_path(@conn, :initiate_2fa_setup)} for={@conn.params} method="post" > <.button type="submit" mt?={false}> Enable 2FA
<:icon> <:buttons> <.button type="submit" class="w-full sm:w-auto"> Disable 2FA
Once disabled, verification codes from the authenticator application and current recovery codes will become invalid. 2FA will have to be setup from the start.
Enter your password to disable 2FA.
<.input type="password" id="disable_2fa_password" name="password" value="" placeholder="Enter password" x-ref="disable2FAPassword" />
<:icon> <:buttons> <.button id="generate-2fa-recovery-button" type="submit" class="w-full sm:w-auto [&>span.label-enabled]:block [&>span.label-disabled]:hidden [&[disabled]>span.label-enabled]:hidden [&[disabled]>span.label-disabled]:block" > Generate New Codes <.spinner class="inline-block h-5 w-5 mr-2 text-white dark:text-gray-400" /> Generating Codes
If you generate new codes, the old ones will become invalid.
Enter your password to continue.
<.input type="password" id="regenerate_2fa_password" name="password" value="" placeholder="Enter password" x-ref="regenerate2FAPassword" />
<.tile docs="login-management"> <:title> Login management <:subtitle> Log out other devices. Inactive sessions auto-expire after 14 days. <.table rows={@user_sessions}> <:thead> <.th>Device <.th hide_on_mobile>Last seen <.th invisible>Actions <:tbody :let={session}> <.td truncate max_width="max-w-40">{session.device} <.td hide_on_mobile>{Plausible.Auth.UserSessions.last_used_humanize(session)} <.td :if={@current_user_session.id == session.id} actions>Current session <.td :if={@current_user_session.id != session.id} actions> <.delete_button href={Routes.settings_path(@conn, :delete_session, session.id)} method="delete" data-confirm="Are you sure you want to log out this session?" />