Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions client/client-landing/services/validate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ const instance: AxiosInstance = axios.create({

export const getUser = async (id: string): Promise<boolean> => {
try {
await instance.get(`/users/${id}`);
return true;
const { data } = await instance.get(`/users/${id}`);
if (data.type === "User")
return true;
return false;
} catch (error) {
return false;
}
Expand Down
8 changes: 5 additions & 3 deletions server/githubsrm/apis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ def verify_github_details(verify_user=False, **kwargs):

if verify_user:
response = session.get(f"{github_api}/users/{kwargs['user_id']}")
if response.status_code == 403:
response = session.get(f"{source_route}/{kwargs['user_id']}")
return response.status_code == 200
res = response.json()
if(res['type']=="User" and response.status_code == 200):
return response.status_code == 200
elif(res['type']!="User" and response.status_code == 200):
return False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a nested elif instead of using the same check at two levels

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Codered9 any updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the required changes. The last commit is a wip commit as local env was creating a build issue.

else:
# Todo: move to github apis after discussion on porting
# Used for existing projects.
Expand Down