microsoft login #1 - #22
Open
Aryan1296 wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feat: Add Microsoft Login and Two-Factor Authentication
This pull request significantly enhances the application's security and authentication capabilities. It introduces Microsoft Account as a new OAuth provider and implements a complete Two-Factor Authentication (2FA) system to provide users with an essential layer of security.
Problem
The application previously lacked a sufficient number of authentication options and was missing critical security features like 2FA. This limited user choice for logging in and left user accounts vulnerable to unauthorized access if their primary credentials were compromised.
Solution
This PR addresses these issues by implementing two major features:
Microsoft Authentication: Integrated the necessary Passport.js strategy to allow users to sign up and log in securely using their Microsoft accounts.
Two-Factor Authentication (2FA): A full 2FA system has been built from the ground up. This includes the logic for generating secrets, displaying QR codes for authenticator apps, verifying tokens, and providing one-time backup codes.
Key Changes
Microsoft OAuth Integration:
Added configuration and routes for the Microsoft authentication strategy.
Updated the login and signup pages to include a "Login with Microsoft" button.
New Security Controller:
Created controllers/security.js to handle all logic related to enabling/disabling 2FA and verifying codes.
New Account Management Views:
Added views/account/security.pug as a central hub for users to manage their security settings.
Created views/account/2-fac-setup.pug to guide users through the 2FA setup process with a QR code.
Implemented views/account/2-fac-prompt.pug which is shown after login to request the user's 2FA token.
Added views/bkup-codes.pug to display one-time backup codes for recovery.