Skip to content

Commit

Permalink
fix: mfa pair validation error message (#296)
Browse files Browse the repository at this point in the history
* fix: put short inline error msg's on new line

* enhance: user-friendly mfa validation error msg

* feat: include technical error message

* chore: nx format:write

* Revert "feat: include technical error message"

This reverts commit 11aff00.
  • Loading branch information
wesleyboar authored Aug 14, 2023
1 parent 1c5d247 commit cac62b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions libs/tup-components/src/mfa/Mfa.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ li.pairing-separator {
margin-top: 30px; /* match .mfa-success-container button */
}

.field-error {
/* so message with very littel text still appears beneath input */
display: flex;
}

/* TOTP pairing styles */
.qr-code-box > * {
--border-width: var(--global-border-width--xx-thick);
Expand Down
6 changes: 5 additions & 1 deletion libs/tup-components/src/mfa/MfaSmsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ const MfaSmsPanel: React.FC = () => {
onChange={(e) => setPhoneNumber(e.target.value)}
/>
{smsMutation.isError && (
<InlineMessage type="error" tagName="small">
<InlineMessage
type="error"
tagName="small"
className={styles['field-error']}
>
Unable to pair via SMS. If this error persists,{' '}
<TicketCreateModal display="link">
submit a ticket
Expand Down
8 changes: 6 additions & 2 deletions libs/tup-components/src/mfa/MfaValidationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ const MfaValidationPanel: React.FC<{ tokenType: 'totp' | 'sms' }> = ({
onChange={(e) => setTokenValue(e.target.value)}
/>
{error && (
<InlineMessage type="error" tagName="small">
Error validating MFA token: "{error.message}"
<InlineMessage
type="error"
tagName="small"
className={styles['field-error']}
>
Your token is invalid.
</InlineMessage>
)}
</div>
Expand Down

0 comments on commit cac62b1

Please sign in to comment.