hotfix: magiclink dynamic email redirection url (#67)

* chore: modified magiclink /signin function to work with origin

* chore: modified testcases for signInMagicLink to reflect new changes

* chore: removed prisma migration file

* chore: removed admin module dulicate from guards folder

* chore: implemented ENUMs for origins in signin method

* chore: added VITE_ADMIN_URL to .env.example file
This commit is contained in:
Balu Babu
2023-04-06 11:41:01 +05:30
committed by GitHub
parent 6d688ed2bc
commit 22aa8ee334
5 changed files with 32 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import {
Controller,
Get,
Post,
Query,
Req,
Request,
Res,
@@ -34,9 +35,13 @@ export class AuthController {
** Route to initiate magic-link auth for a users email
*/
@Post('signin')
async signInMagicLink(@Body() authData: SignInMagicDto) {
async signInMagicLink(
@Body() authData: SignInMagicDto,
@Query('origin') origin: string,
) {
const deviceIdToken = await this.authService.signInMagicLink(
authData.email,
origin,
);
if (E.isLeft(deviceIdToken)) throwHTTPErr(deviceIdToken.left);
return deviceIdToken.right;