Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: changed login error message #76

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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