Skip to content

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

Description

@nekromoff

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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions