The IMAGINE - AI, which is built using the OpenAI API library DALL-E 2, aims to solve the problem of limited creativity and imagination. This is a fully mobile responsive image generator built with Node.js and Express that uses OpenAI's Dall-E models to generate images.
Created separate controllers (googleAuthController, facebookAuthController, twitterAuthController) to handle authentication for each provider (Google, Facebook, and Twitter).
Each controller includes:
authRegister: Initiates the OAuth process.
successRegister: Called on successful authentication and registration, redirecting users to the designated page or sign-up prompt.
successLogin: Called on successful authentication and login, directing users to the appropriate page or sign-up prompt.
Authentication Route Modifications:
Modified the existing authRoutes.js file to include routes for each OAuth provider.
Added /auth/google, /auth/facebook, and /auth/twitter routes to handle sign-up and login requests, using passport authentication strategies for each provider.
Frontend Sign-Up and Sign-In Modifications:
Updated the HTML for the sign-in and sign-up options:
Added links to /auth/google, /auth/facebook, and /auth/twitter in the sign-in and sign-up sections.
Configured respective SVG icons for Google, Facebook, and Twitter for consistent visual branding.
Ensured accessibility and button responsiveness by assigning aria-label attributes and relevant class names (e.g., google-button, facebook-button, twitter-button).
Additional Validation and Token Handling:
For regular sign-up and login, implemented validation for names, emails, and passwords, using email-validator and password-validator libraries.
Used the sendToken function to generate and send JSON Web Tokens (JWTs) for users upon successful login or registration.
Controller Functions for Login and Sign-Up:
The authController functions (signupController and loginController) handle registration and login validation, create a new user if needed, and return a JWT upon successful login.
[X] Tests have been added or updated to cover the changes
[ ] Documentation has been updated to reflect the changes
[X] Code follows the established coding style guidelines
Fixes #1376
Description
OAuth Authentication Setup:
Created separate controllers (googleAuthController, facebookAuthController, twitterAuthController) to handle authentication for each provider (Google, Facebook, and Twitter). Each controller includes: authRegister: Initiates the OAuth process. successRegister: Called on successful authentication and registration, redirecting users to the designated page or sign-up prompt. successLogin: Called on successful authentication and login, directing users to the appropriate page or sign-up prompt. Authentication Route Modifications:
Modified the existing authRoutes.js file to include routes for each OAuth provider. Added /auth/google, /auth/facebook, and /auth/twitter routes to handle sign-up and login requests, using passport authentication strategies for each provider. Frontend Sign-Up and Sign-In Modifications:
Updated the HTML for the sign-in and sign-up options: Added links to /auth/google, /auth/facebook, and /auth/twitter in the sign-in and sign-up sections. Configured respective SVG icons for Google, Facebook, and Twitter for consistent visual branding. Ensured accessibility and button responsiveness by assigning aria-label attributes and relevant class names (e.g., google-button, facebook-button, twitter-button). Additional Validation and Token Handling:
For regular sign-up and login, implemented validation for names, emails, and passwords, using email-validator and password-validator libraries. Used the sendToken function to generate and send JSON Web Tokens (JWTs) for users upon successful login or registration. Controller Functions for Login and Sign-Up:
The authController functions (signupController and loginController) handle registration and login validation, create a new user if needed, and return a JWT upon successful login.