From 3e5f15904ed91aa588db9f2b8d8f659929c729cc Mon Sep 17 00:00:00 2001 From: ShaneKianCastillo Date: Sun, 12 Oct 2025 13:42:33 +0800 Subject: [PATCH] added the changes in forgot password and new password --- src/components/Instructor/ForgotPassword.jsx | 32 ++-- src/components/Instructor/newPassword.jsx | 177 +++++++++++++------ 2 files changed, 138 insertions(+), 71 deletions(-) diff --git a/src/components/Instructor/ForgotPassword.jsx b/src/components/Instructor/ForgotPassword.jsx index 53ff047..d488510 100644 --- a/src/components/Instructor/ForgotPassword.jsx +++ b/src/components/Instructor/ForgotPassword.jsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; -import Logo1 from "../../assets/img/Dct-Logo.png"; +import Logo1 from "../../assets/img/TaskSphereLogo.png"; import Swal from "sweetalert2"; import { showOTP, fetchAdminEmail } from "../../assets/scripts/forgotPassword"; @@ -25,7 +25,7 @@ const ForgotPassword = () => { icon: "warning", title: "Enter your email", text: "Please provide the email you registered with.", - confirmButtonColor: "#3B0304", + confirmButtonColor: "#611A11", }); return; } @@ -40,7 +40,7 @@ const ForgotPassword = () => { icon: "error", title: "Not an admin email", text: "Only admin accounts can reset a password here.", - confirmButtonColor: "#3B0304", + confirmButtonColor: "#611A11", }); return; } @@ -57,7 +57,7 @@ const ForgotPassword = () => { icon: "success", title: "OTP sent", html: `We've sent a 6-digit code to ${entered}.`, - confirmButtonColor: "#3B0304", + confirmButtonColor: "#611A11", allowOutsideClick: false, allowEscapeKey: false, }); @@ -68,7 +68,6 @@ const ForgotPassword = () => { expectedOtp: otp, onConfirm: async (code, { expected }) => { if (String(code) === String(expected)) { - //alert("success"); navigate("/NewPassword", { state: { email: entered } }); return true; // ✅ close the Swal } @@ -87,7 +86,7 @@ const ForgotPassword = () => { icon: "error", title: "Something went wrong", text: err?.message || "Please try again in a moment.", - confirmButtonColor: "#3B0304", + confirmButtonColor: "#611A11", }); } finally { setSending(false); @@ -95,18 +94,19 @@ const ForgotPassword = () => { }; return ( -
-
+
+
DCT Logo -

+

Forgot Password?

- No worries! To reset your password, we’ll send a one-time password + No worries! To reset your password, we'll send a one-time password (OTP) to your registered email address. Please check your inbox and follow the instructions to continue.

@@ -115,7 +115,7 @@ const ForgotPassword = () => {
@@ -125,17 +125,17 @@ const ForgotPassword = () => { value={email} onChange={(e) => setEmail(e.target.value)} placeholder="admin1@gmail.com" - className="w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-[#3B0304] focus:outline-none" + className="w-full p-3 bg-white border border-gray-300 rounded-md focus:ring-2 focus:ring-[#611A11] focus:border-[#611A11] focus:outline-none" />
+ {passwordError && ( +

{passwordError}

+ )} + {/* Password Requirements */} +
+

Password must contain:

+
    +
  • = 8 ? "text-green-600" : ""}>At least 8 characters
  • +
  • One uppercase letter
  • +
  • One lowercase letter
  • +
  • One number
  • +
  • \/?]/.test(newPw) ? "text-green-600" : ""}>One special character
  • +
  • No spaces
  • +
+
{/* Confirm Password */}
-