mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-23 05:01:49 +10:00
🚀 release: v3.0.0
This commit is contained in:
18
apps/server/src/auth/strategy/local.strategy.ts
Normal file
18
apps/server/src/auth/strategy/local.strategy.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Strategy } from 'passport-local';
|
||||
|
||||
import { User } from '@/users/entities/user.entity';
|
||||
|
||||
import { AuthService } from '../auth.service';
|
||||
|
||||
@Injectable()
|
||||
export class LocalStrategy extends PassportStrategy(Strategy) {
|
||||
constructor(private authService: AuthService) {
|
||||
super({ usernameField: 'identifier' });
|
||||
}
|
||||
|
||||
async validate(identifier: string, password: string): Promise<User> {
|
||||
return this.authService.getUser(identifier, password);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user