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 e5a21a6
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 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,23 @@ 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 +267,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 e5a21a6

Please sign in to comment.