Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Move alerts to top of form
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Jun 25, 2024
1 parent de2859e commit 56a683d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions frontend/src/routes/password.change.index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ function ChangePassword(): React.ReactNode {
method = POST just prevents sending passwords in the query string,
which could be logged, if for some reason the event handler fails.
*/}
{unhandleableError && (
<Alert
type="critical"
title={t("frontend.password_change.failure.title")}
>
{t("frontend.password_change.failure.description.unspecified")}
</Alert>
)}

{handleableError && (
<Alert
type="critical"
title={t("frontend.password_change.failure.title")}
>
{errorMsg}
</Alert>
)}


<Form.Field
name="current_password"
Expand Down Expand Up @@ -250,29 +268,11 @@ function ChangePassword(): React.ReactNode {
</Form.HelpMessage>
</Form.Field>

{unhandleableError && (
<Alert
type="critical"
title={t("frontend.password_change.failure.title")}
>
{t("frontend.password_change.failure.description.unspecified")}
</Alert>
)}

<Form.Submit kind="primary" disabled={result.fetching}>
{!!result.fetching && <LoadingSpinner inline />}
{t("action.save")}
</Form.Submit>

{handleableError && (
<Alert
type="critical"
title={t("frontend.password_change.failure.title")}
>
{errorMsg}
</Alert>
)}

<ButtonLink to="/" kind="tertiary">
{t("action.cancel")}
</ButtonLink>
Expand Down

0 comments on commit 56a683d

Please sign in to comment.