Skip to content

Commit

Permalink
otp logic issue solved
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Aug 31, 2024
1 parent a87ab32 commit 4a5bb1d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/src/use_case/patient/AuthPatientUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export default class LoginPatientUseCase {

if (foundedPatient.isBlocked) throw new Error("Unauthorized");

let otp = parseInt(generateOTP(6));
while (otp.toString().length === 6) {
otp = parseInt(generateOTP(6));
let otp = parseInt(generateOTP(6),10);
while (otp.toString().length !== 6) {
otp = parseInt(generateOTP(6),10);
}
await this.otpRepository.create(otp, foundedPatient.email!);

Expand All @@ -39,9 +39,9 @@ export default class LoginPatientUseCase {
const patient = await this.patientRepository.findByEmail(email);
if (!patient) throw new Error("Patient Not Found");

let otp = parseInt(generateOTP(6));
while (otp.toString().length === 6) {
otp = parseInt(generateOTP(6));
let otp = parseInt(generateOTP(6),10);
while (otp.toString().length !== 6) {
otp = parseInt(generateOTP(6),10);
}
await this.otpRepository.create(otp, email);
await this.emailService.sendOtp(email, patient.name!, otp);
Expand Down

1 comment on commit 4a5bb1d

@vercel
Copy link

@vercel vercel bot commented on 4a5bb1d Aug 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.