File

apps/api/src/auth/strategies/local.strategy.ts

Extends

PassportStrategy(Strategy, 'local')

Index

Methods

Constructor

constructor(authService: AuthService)
Parameters :
Name Type Optional
authService AuthService No

Methods

validate
validate(email: string, password: string)
Parameters :
Name Type Optional
email string No
password string No
import { Injectable } from '@nestjs/common'
import { PassportStrategy } from '@nestjs/passport'
import { Strategy } from 'passport-local'

import { AuthService } from '../auth.service'
import { LoginResponseInterface } from '@isomera/interfaces'

@Injectable()
export class LocalStrategy extends PassportStrategy(Strategy, 'local') {
  constructor(private readonly authService: AuthService) {
    super({
      usernameField: 'email',
      passReqToCallback: false
    })
  }

  validate(email: string, password: string): Promise<LoginResponseInterface> {
    return this.authService.login(email, password)
  }
}

results matching ""

    No results matching ""