BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Download profile image on registration/login using OAuth2 / social logins

Open nekromoff opened this issue 5 years ago • 1 comments

Describe the feature you'd like Currently a new user gets a random profile image instead of image being taken from the social login service. This should be easy to implement, basically a cosmetic change.

Describe the benefits this feature would bring to BookStack users Smoother UX. Profile automatically built from existing info using social login.

Additional context n/a

example code - tested with google login

// remote user
$user = Socialite::driver('google')->stateless()->redirectUrl(route('login.google.callback'))->with(['redirect_uri' => route('login.google.callback')])->user();
//generate image name
$whatever_image_name=trim(strtolower(str_replace(' ', '', iconv('UTF-8', 'ASCII//TRANSLIT', $user->getName())))); 
// avatar image, replacing smaller size for larger size
$avatar = str_replace('sz=50', 'sz=200', $user->getAvatar());
// save image
Storage::put('users/' . $whatever_image_name, file_get_contents($avatar));
// set profile image for a local user
$local_user->image =$whatever_image_name;

nekromoff avatar Nov 14 '20 17:11 nekromoff

  • ref: https://github.com/BookStackApp/BookStack/pull/5429
  • ref: https://github.com/BookStackApp/BookStack/pull/5626

rubentalstra avatar May 24 '25 19:05 rubentalstra