From ee3de663b5bb2f25996a894249e0477b7ea95078 Mon Sep 17 00:00:00 2001
From: Simon Larsen
Date: Sun, 28 Jul 2024 12:29:55 -0600
Subject: [PATCH] feat: Add two-factor authentication support to login page
This commit adds support for two-factor authentication on the login page. It includes the necessary code changes to display the two-factor authentication UI elements when the user has enabled it. The login form now includes a field for entering the two-factor authentication code. Additionally, the API endpoint for verifying the two-factor authentication code has been implemented. This feature enhances the security of the login process by adding an extra layer of authentication.
Files modified:
- Accounts/src/Pages/Login.tsx
- App/FeatureSet/Identity/API/Authentication.ts
- CommonServer/Utils/TwoFactorAuth.ts
---
Accounts/src/Pages/Login.tsx | 34 +++++++++++++++----
App/FeatureSet/Identity/API/Authentication.ts | 26 +++++++++-----
CommonServer/Utils/TwoFactorAuth.ts | 2 +-
3 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/Accounts/src/Pages/Login.tsx b/Accounts/src/Pages/Login.tsx
index bd02c9e62d4..2a942547e64 100644
--- a/Accounts/src/Pages/Login.tsx
+++ b/Accounts/src/Pages/Login.tsx
@@ -79,13 +79,20 @@ const LoginPage: () => JSX.Element = () => {
src={OneUptimeLogo}
alt="OneUptime"
/>
-
+ {!showTwoFactorAuth && <>
Sign in to your account
Join thousands of business that use OneUptime to help them stay online
all the time.
-
+
>}
+
+ {showTwoFactorAuth && <>
+ Two Factor Authentication
+
+
+ Select two factor authentication method. You will be asked to enter a code from the selected method.
+