feat :VerifyOtp and SendOtp creation for "seetings", "send monet", "password expiry" and "set login and tpassword"
This commit is contained in:
@@ -23,15 +23,7 @@ export default function ChangePassword() {
|
||||
const [step, setStep] = useState<"form" | "otp" | "final">("form");
|
||||
const [passwordHistory] = useState(["Pass@1234", "OldPass@123", "MyPass#2023"]);
|
||||
const icon = <IconLock size={18} stroke={1.5} />;
|
||||
const [showOtpField, setShowOtpField] = useState(false);
|
||||
|
||||
// const handleGenerateOtp = async () => {
|
||||
// const value = "123456"; // Or generate a random OTP
|
||||
// setGeneratedOtp(value);
|
||||
// setCountdown(180);
|
||||
// setTimerActive(true);
|
||||
// return value;
|
||||
// };
|
||||
|
||||
async function handleSendOtp() {
|
||||
const mobileNumber = localStorage.getItem('remitter_mobile_no');
|
||||
@@ -45,7 +37,6 @@ export default function ChangePassword() {
|
||||
}
|
||||
try {
|
||||
await sendOtp({ type: 'CHANGE_LPWORD' });
|
||||
setShowOtpField(true);
|
||||
setCountdown(180);
|
||||
setTimerActive(true);
|
||||
} catch (err: any) {
|
||||
@@ -152,15 +143,16 @@ export default function ChangePassword() {
|
||||
|
||||
// Step 2 → validate OTP
|
||||
if (step === "otp") {
|
||||
if (otp !== generatedOtp) {
|
||||
const verified = await handleVerifyOtp();
|
||||
if (!verified) {
|
||||
notifications.show({
|
||||
title: "Invalid OTP",
|
||||
message: "Please enter the correct OTP.",
|
||||
message: "The OTP entered does not match",
|
||||
color: "red",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
setOtpValidated(true);
|
||||
setStep("final");
|
||||
notifications.show({
|
||||
|
||||
@@ -151,10 +151,11 @@ export default function ChangePassword() {
|
||||
|
||||
// Step 2 → validate OTP
|
||||
if (step === "otp") {
|
||||
if (otp !== generatedOtp) {
|
||||
const verified = await handleVerifyOtp();
|
||||
if (!verified) {
|
||||
notifications.show({
|
||||
title: "Invalid OTP",
|
||||
message: "Please enter the correct OTP.",
|
||||
message: "The OTP entered does not match",
|
||||
color: "red",
|
||||
});
|
||||
return;
|
||||
|
||||
@@ -159,10 +159,11 @@ export default function ChangePassword() {
|
||||
}
|
||||
// Step 2 → validate OTP
|
||||
if (step === "otp") {
|
||||
if (otp !== generatedOtp) {
|
||||
const verified = await handleVerifyOtp();
|
||||
if (!verified) {
|
||||
notifications.show({
|
||||
title: "Invalid OTP",
|
||||
message: "Please enter the correct OTP.",
|
||||
message: "The OTP entered does not match",
|
||||
color: "red",
|
||||
});
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user