manu-chroma / username-availability-checker

Live at : https://username-check.herokuapp.com/
96 stars 36 forks source link

Add support for gravatar #108

Closed kx-chen closed 6 years ago

kx-chen commented 6 years ago

Add support for profile pictures and username checking for gravatar.

Closes https://github.com/manu-chroma/username-availability-checker/issues/37

Gravatar does not have their images as normal img tags, instead it has it as background pictures in an a tag. As a result, I have to parse for the href of the a tag, instead of the src of the img tag. Please advise if there is a better way to implement this.

Another method that I tried to use was directly getting the profile picture url through Gravatar's json api. (ex: https://en.gravatar.com/kaiusesthis.json). I tried to do that by adding a keys key in the websites.yml file. However, this caused more headache down the road as this meant the link on the frontend would go to the json endpoint. Additionally, the regex that parsed the keys value did not work properly. It would return the wrong json.

Would love to hear feedback on how to make this better.

kx-chen commented 6 years ago

@stellargo Thanks for the review.

I changed the commit message but then changed it back after looking at coala.io/commit. According to the page, messages should be written in "imperative present tense". ("add" NOT "adding" or "added"). I think what it is currently should be fine. (unless I understood the page wrong)

seeeturtle commented 6 years ago

For more detail, you should add test info in tests/test_data.yml involving invalid username, taken username, and available username.