Skip to content

Commit 2d87f5b

Browse files
committed
refactor: remove email validation logic from signInWithEmail and AuthService
1 parent 6c392ac commit 2d87f5b

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

server/src/auth/auth.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type { Request, Response } from 'express';
1616

1717
import { AuthService } from './auth.service';
1818
import { MagicLinkEmailStrategy } from './strategies/magicLinkEmail.strategy';
19+
import { Throttle } from '@nestjs/throttler';
1920

2021
@Controller('auth')
2122
@ApiTags('auth')
@@ -51,7 +52,6 @@ export class AuthController {
5152
},
5253
})
5354
public async signInWithEmail(@Req() req: Request, @Res() res: Response) {
54-
await this.authService.validateEmail(req.body);
5555
return this.magicLinkEmailStrategy.send(req, res);
5656
}
5757

server/src/auth/auth.service.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -261,32 +261,4 @@ export class AuthService {
261261

262262
return user;
263263
}
264-
265-
public async validateEmail(body: Record<string, string | undefined>) {
266-
// get destination from body
267-
const { destination } = body;
268-
269-
if (!destination) {
270-
throw new HttpException(
271-
{
272-
error: 'destination email not provided',
273-
},
274-
HttpStatus.BAD_REQUEST,
275-
);
276-
}
277-
278-
// find user by email
279-
const user = await this.userService.findByEmail(destination);
280-
281-
if (!user) {
282-
throw new HttpException(
283-
{
284-
error: 'User not found',
285-
},
286-
HttpStatus.NOT_FOUND,
287-
);
288-
} else {
289-
return user;
290-
}
291-
}
292264
}

0 commit comments

Comments
 (0)