Skip to content

Commit

Permalink
Merge pull request #76 from credebl/passkey-fixes
Browse files Browse the repository at this point in the history
fix: changed login error message
Signed-off-by: tipusinghaw <[email protected]>
  • Loading branch information
nishad-ayanworks authored and tipusinghaw committed Sep 13, 2023
2 parents 76db215 + cf95ce4 commit 63c2bca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright [2023] [Blockster Labs Private Limited]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion apps/api-gateway/src/fido/fido.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class FidoController {
const fidoUserDetails = await this.fidoService.fetchFidoUserDetails(req.params.userName);
const finalResponse: IResponseType = {
statusCode: HttpStatus.OK,
message: ResponseMessages.user.success.login,
message: ResponseMessages.user.success.fetchUsers,
data: fidoUserDetails.response
};
return res.status(HttpStatus.OK).json(finalResponse);
Expand Down
31 changes: 14 additions & 17 deletions apps/user/src/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,35 +276,32 @@ export class UserService {
return this.generateToken(email, decryptedPassword);
}

return this.generateToken(email, password);
return this.generateToken(email, password);
} catch (error) {
this.logger.error(`In Login User : ${JSON.stringify(error)}`);
throw new RpcException(error.response);
}
}

async generateToken(email: string, password: string): Promise<object> {
try {
const supaInstance = await this.supabaseService.getClient();
const supaInstance = await this.supabaseService.getClient();

this.logger.error(`supaInstance::`, supaInstance);
this.logger.error(`supaInstance::`, supaInstance);

const { data, error } = await supaInstance.auth.signInWithPassword({
email,
password
});
const { data, error } = await supaInstance.auth.signInWithPassword({
email,
password
});

if (error) {
this.logger.error(`Supa Login Error::`, JSON.stringify(error));
throw new BadRequestException(error?.message);
}
this.logger.error(`Supa Login Error::`, JSON.stringify(error));

const token = data?.session;
return token;
} catch (error) {
this.logger.error(`An unexpected error occurred::`, error.message);
throw new InternalServerErrorException('An unexpected error occurred.');
if (error) {
throw new BadRequestException(error?.message);
}

const token = data?.session;

return token;
}

async getProfile(payload: { id }): Promise<object> {
Expand Down

0 comments on commit 63c2bca

Please sign in to comment.