Skip to content

Improve error messaging for login/register flows#175

Merged
runleveldev merged 6 commits intomainfrom
copilot/improve-error-messaging-login-register
Feb 3, 2026
Merged

Improve error messaging for login/register flows#175
runleveldev merged 6 commits intomainfrom
copilot/improve-error-messaging-login-register

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Improve Error Messaging for Login/Register Process ✅

  • Issue 1: Registration duplicate key errors

    • Modified /create-a-container/routers/register.js to catch Sequelize unique constraint errors
    • Display user-friendly messages for duplicate username/email
    • Added null safety checks for error handling
  • Issue 2: Login 2FA waiting banner

    • Added loading/waiting message while backend waits for 2FA push notification
    • Updated /create-a-container/views/login.ejs to show temporary banner with hourglass emoji
    • Disabled submit button to prevent double submission
    • Wrapped JavaScript in DOMContentLoaded event listener
    • Moved inline styles to CSS classes
  • Issue 3: Specific 2FA error messages

    • Replaced generic "Authentication request was denied" error
    • Added specific messages for "notification denied" and "notification timed out"
    • Updated error handling in /create-a-container/routers/login.js
  • Code Review Feedback

    • Moved all inline styles to dedicated CSS classes in style.css
    • Created reusable alert classes (alert-success, alert-error, alert-info)
    • Updated both login.ejs and register.ejs to use CSS classes
  • Testing & Validation

    • Manual testing completed successfully
    • Code review completed - all issues addressed
    • CodeQL security scan passed - 0 vulnerabilities
    • Screenshots captured showing all new features

Implementation Details

Registration Error Messages

The registration handler now catches SequelizeUniqueConstraintError and provides specific, user-friendly messages:

  • Duplicate username: "This username is already registered. Please choose a different username or login with your existing account."
  • Duplicate email: "This email address is already registered. Please use a different email or login with your existing account."
  • Other constraint violations: "A user with these details is already registered. Please login with your existing account."

Duplicate username error

2FA Loading Banner

A blue informational banner appears during login form submission with:

  • Hourglass emoji (⏳) and "Waiting for authentication..." heading
  • Instructions: "Please check your device and respond to the push notification."
  • Submit button disabled and changed to "Authenticating..." to prevent double submission
  • JavaScript wrapped in DOMContentLoaded for safety
  • Styled using CSS classes from style.css

2FA loading banner

2FA Error Messages

The 2FA error handling now distinguishes between:

  • Explicit rejection (action === 'REJECT'): "Authentication request was denied. You rejected the notification."
  • Timeout (result.timeout or error includes 'timeout'): "Authentication request timed out. Please try again and respond to the notification promptly."
  • Other failures: "Authentication request failed. Please try again."

CSS Refactoring

Created reusable alert classes in style.css:

.alert { /* Base alert styling */ }
.alert-success { /* Green for success messages */ }
.alert-error { /* Red for error messages */ }
.alert-info { /* Blue for informational messages */ }

All inline styles have been removed from templates and replaced with these CSS classes, improving maintainability and consistency.

Security Summary

✅ CodeQL scan completed with 0 vulnerabilities detected.

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Error Messaging for Login/Register Process</issue_title>
<issue_description>- When a user registers, duplicate key errors on username/email should flash an error that user is already registered.

  • On login, a temporary banner should be displayed while the backend waits for the 2FA push notification response.
  • Instead of the generic "Authentication request was denied error" from a failed 2FA push notification, the error message flashed to the user should specify notification denied or notification timed out.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Improve error messaging for login and registration process Improve error messaging for login/register flows Feb 3, 2026
Copilot AI requested a review from runleveldev February 3, 2026 18:24
@runleveldev runleveldev force-pushed the copilot/improve-error-messaging-login-register branch 2 times, most recently from 170ef4b to e1e486a Compare February 3, 2026 18:48
Copilot AI and others added 2 commits February 3, 2026 13:53
- Add user-friendly error messages for duplicate username/email during registration
- Distinguish between 2FA notification denied vs timeout
- Add loading banner during 2FA authentication wait

Co-authored-by: runleveldev <44057501+runleveldev@users.noreply.github.com>
…aded wrapper

Co-authored-by: runleveldev <44057501+runleveldev@users.noreply.github.com>
@runleveldev runleveldev force-pushed the copilot/improve-error-messaging-login-register branch from e1e486a to c3c463d Compare February 3, 2026 18:53
- Created reusable alert classes (alert, alert-success, alert-error, alert-info)
- Replaced all inline styles in login.ejs and register.ejs with CSS classes
- Loading banner now uses alert alert-info classes with only display:none inline
- Improves maintainability and consistency across the application

Co-authored-by: runleveldev <44057501+runleveldev@users.noreply.github.com>
@runleveldev runleveldev marked this pull request as ready for review February 3, 2026 21:02
Copy link
Collaborator

@cmyers-mieweb cmyers-mieweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets get this merged

@runleveldev runleveldev merged commit 3421e6e into main Feb 3, 2026
4 checks passed
@runleveldev runleveldev deleted the copilot/improve-error-messaging-login-register branch February 3, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Error Messaging for Login/Register Process

3 participants