diff --git a/client/client-landing/services/validate.tsx b/client/client-landing/services/validate.tsx index 50cd7d5a..1fc6c057 100644 --- a/client/client-landing/services/validate.tsx +++ b/client/client-landing/services/validate.tsx @@ -6,8 +6,10 @@ const instance: AxiosInstance = axios.create({ export const getUser = async (id: string): Promise => { 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; } diff --git a/server/githubsrm/apis/utils.py b/server/githubsrm/apis/utils.py index 02d530e1..db7df5ec 100644 --- a/server/githubsrm/apis/utils.py +++ b/server/githubsrm/apis/utils.py @@ -44,9 +44,15 @@ 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() + # Will send False to the frontend if server is down or User ID is not a personal id but a Organisation ID. + if(response.status_code == 200): + if(res['type']=="User" ): + return True + else: + return False + else: + return False else: # Todo: move to github apis after discussion on porting # Used for existing projects.