1
0
forked from Yara724/api

Added linkToken and linkContext to OTP

This commit is contained in:
SepehrYahyaee
2026-05-13 09:23:45 +03:30
parent e26c533a52
commit 5b6409fc2e
9 changed files with 344 additions and 28 deletions

View File

@@ -1,6 +1,10 @@
import { Injectable, UnauthorizedException } from "@nestjs/common";
import { Injectable } from "@nestjs/common";
import { PassportStrategy } from "@nestjs/passport";
import { Strategy } from "passport-local";
import {
UserAuthErrorCode,
throwUserAuthError,
} from "src/auth/auth-services/user-auth-error";
import { UserAuthService } from "src/auth/auth-services/user.auth.service";
@Injectable()
@@ -12,7 +16,7 @@ export class LocalStrategy extends PassportStrategy(Strategy) {
async validate(username: string, password: string): Promise<any> {
const user = await this.userAuthService.validateUser(username, password);
if (!user) {
throw new UnauthorizedException("user not found please register");
throwUserAuthError(UserAuthErrorCode.OTP_INVALID);
}
return user;
}