Home Projects Portfolio Dashboard Export PDF Log in

Cronix Project: Enhancements in Authentication, Session Management, and User Experience

The Cronix project has recently undergone significant updates focused on enhancing user authentication, session management, and overall user experience. These improvements span from implementing passkey authentication to refining session timeout handling and introducing a progressive web app (PWA) install banner.

Passkey Authentication

One of the major features added is passkey (WebAuthn) support. This allows users to register passkeys from their profiles and use biometric login on the login screen. Passkeys offer a more secure and convenient alternative to traditional passwords.

To manage passkeys effectively, a dedicated hook usePasskey was created, encapsulating functionalities for enrollment, authentication, unenrollment, and refreshing authentication factors. This hook streamlines passkey interactions within the application.

// Example: Simplified usePasskey hook
const usePasskey = () => {
  const enroll = async (options: any) => { /* ... */ };
  const authenticate = async (options: any) => { /* ... */ };
  const unenroll = async (id: string) => { /* ... */ };
  const refreshFactors = async () => { /* ... */ };

  return { enroll, authenticate, unenroll, refreshFactors };
};

This example showcases a simplified structure of the usePasskey hook, abstracting the complexities of WebAuthn interactions into reusable functions.

Enhanced Session Management

To ensure better security and user experience, the session timeout mechanism was refined. A key improvement was addressing a stale closure bug, ensuring that session timeouts are accurately enforced. To keep sessions alive during activity, a background activity ping was implemented. This sends a signal to the server at throttled intervals, preventing sessions from expiring unexpectedly.

The middleware was updated to set a maximum session cookie duration, further enhancing session security. Also, the inactive detection logic was adjusted to account for the auto-expiration of activity tracking mechanisms.

PWA Install Banner

To improve the mobile user experience, a PWA install floating banner was added. This banner, visible only on mobile devices, prompts users to install the application as a PWA, providing a more app-like experience.

Appointment Validation

An important fix was implemented to prevent double-booking of appointments. A validating state was introduced during submission, along with a runValidation() function. The handleSubmit function now re-validates synchronously before inserting data into the database, mitigating potential race conditions.

Conclusion

The recent updates to the Cronix project demonstrate a commitment to improving security, user experience, and application reliability. By implementing passkey authentication, refining session management, and introducing a PWA install banner, Cronix is becoming more secure, user-friendly, and robust.


Generated with Gitvlg.com

Cronix Project: Enhancements in Authentication, Session Management, and User Experience
Luis Romero

Luis Romero

Author

Share: