login-with-google icon indicating copy to clipboard operation
login-with-google copied to clipboard

Feature: Save google profile picture of the user during account creation

Open mi5t4n opened this issue 8 months ago • 4 comments

Description

This PR saves the google profile picture of the user during account creation.

Demo

  1. Before Screencast 2025-05-05 19:06:18.webm

  2. After Screencast 2025-05-05 19:07:38.webm

Closes - #249

mi5t4n avatar May 05 '25 13:05 mi5t4n

@SH4LIN In my test cases, media_handle_sideload() wasn't handling the temporary files correctly. Even though the MIME types were valid, it rejected the files because they had a .tmp extension, resulting in the error: "You are not allowed to upload the given file type." When the correct extension was set to the file according it's mime type, it worked.

mi5t4n avatar May 07 '25 15:05 mi5t4n

@SH4LIN In my test cases, media_handle_sideload() wasn't handling the temporary files correctly. Even though the MIME types were valid, it rejected the files because they had a .tmp extension, resulting in the error: "You are not allowed to upload the given file type." When the correct extension was set to the file according it's mime type, it worked.

If that's the case then another option is this, we identify mime, and ext from our end pass it to the file array with key type and ext. Can we check whether this solution works or not.

SH4LIN avatar May 07 '25 15:05 SH4LIN

image

"You can change your profile picture on Gravatar."

Wouldn't this be confusing? Currently, the feature only updates the image during registration. We should either periodically check for updates, add a button to re-sync the image, or enhance the feature to also check the profile image during login.

At the moment, I can think of two ways to make it better.

  1. Override the defaule Profile Picture section to handle the removal and upload of the picture.

Before: 2025-05-15_20-58_1

After: 2025-05-15_20-58

  1. Create a new section called Google Profile Picture and a global setting to override the default avatar.

2025-05-15_21-11

LMK your thoughts on this.

cc @SH4LIN @joelabreo227

mi5t4n avatar May 15 '25 15:05 mi5t4n

@SH4LIN In my test cases, media_handle_sideload() wasn't handling the temporary files correctly. Even though the MIME types were valid, it rejected the files because they had a .tmp extension, resulting in the error: "You are not allowed to upload the given file type." When the correct extension was set to the file according it's mime type, it worked.

If that's the case then another option is this, we identify mime, and ext from our end pass it to the file array with key type and ext. Can we check whether this solution works or not.

I'm not sure why, but during my second test, the .tmp files were no longer created. Now, every profile picture is saved with the correct file extension. Also, we can provide the MIME type, but not the file extension directly — the extension comes from the filename itself. The media_handle_sideload() function throws an error if the file extension doesn’t match the MIME type.

mi5t4n avatar May 16 '25 05:05 mi5t4n