Skip to content

Commit

Permalink
refactor(api): Replaced OTP code from alphanumeric to numeric (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritika1705 authored May 21, 2024
1 parent d6ad277 commit f16162a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/api/src/auth/service/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
NotFoundException,
UnauthorizedException
} from '@nestjs/common'
import { randomUUID } from 'crypto'
import { JwtService } from '@nestjs/jwt'
import { Cron, CronExpression } from '@nestjs/schedule'
import { UserAuthenticatedResponse } from '../auth.types'
Expand Down Expand Up @@ -45,11 +44,11 @@ export class AuthService {
userId: user.id
},
update: {
code: randomUUID().slice(0, 6).toUpperCase(),
code: BigInt(`0x${crypto.randomUUID().replace(/-/g, '')}`).toString().substring(0, 6),
expiresAt: new Date(new Date().getTime() + this.OTP_EXPIRY)
},
create: {
code: randomUUID().slice(0, 6).toUpperCase(),
code: BigInt(`0x${crypto.randomUUID().replace(/-/g, '')}`).toString().substring(0, 6),
expiresAt: new Date(new Date().getTime() + this.OTP_EXPIRY),
user: {
connect: {
Expand Down

0 comments on commit f16162a

Please sign in to comment.