MCPcopy Create free account
hub / github.com/Dyan-Dev/dyan / requestLogin

Method requestLogin

apps/backend/src/auth/auth.controller.ts:60–77  ·  view source on GitHub ↗
(@Body('email') email: string)

Source from the content-addressed store, hash-verified

58
59 @Post('request')
60 async requestLogin(@Body('email') email: string) {
61 if (!email || !email.includes('@')) {
62 throw new HttpException('Invalid email', HttpStatus.BAD_REQUEST);
63 }
64
65 const existingUser = await prisma.user.findFirst();
66
67 let user = await prisma.user.findUnique({ where: { email } });
68
69 if (!user) {
70 // first user becomes admin
71 user = await prisma.user.create({
72 data: { email, isAdmin: !existingUser },
73 });
74 }
75
76 return this.authService.sendMagicLink(email);
77 }
78
79 @Get('verify')
80 async verifyLogin(@Query('token') token: string, @Res() res: Response) {

Callers

nothing calls this directly

Calls 1

sendMagicLinkMethod · 0.80

Tested by

no test coverage detected