Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically login an existing account trying to register again. (Features::loginExistingAccountOnRegister) #115

Closed
DonDiegoAA opened this issue May 16, 2021 · 5 comments · Fixed by #118

Comments

@DonDiegoAA
Copy link

What problem does this feature request solve?.
Avoids displaying an error message to a user trying to register with an existing social account.

Describe your proposed solution
Instead, connect it automatically.
I like the createAccountOnFirstLogin feature.
It would be nice to have the reverse feature loginExistingAccountOnRegister.
Does this cause security issues that I can't see?

Describe alternatives you've considered

Environment context

  • Socialstream version: 3.0.2
  • Jetstream stack: Livewire
  • Laravel version: 8.41.0
  • PHP version: 7.4.16
@joelbutcher
Copy link
Owner

@DonDiegoAA I’ve pushed a branch with a new autoLoginOnRegistration feature. I’m travelling for the weekend to don’t have a lot of time to test this, so feel free to checkout the branch, give it a test yourself and stick any comments in here or PR directly to the branch and I’ll review them when I’m back from my trip.

https://github.com/joelbutcher/socialstream/tree/registration-auto-login

@joelbutcher
Copy link
Owner

@DonDiegoAA I've created a pull request for the change here #118 as an example of how this could work... I'm still in debate as to whether to actually merge this, based off of the original discussions on Jetstream surrounding auto login on registration, before I wrote this package: laravel/jetstream#444

@mjdigital
Copy link

I've just installed this package in a newish project and am getting:

BadMethodCallException
Method JoelButcher\Socialstream\Http\Controllers\OAuthController::login does not exist.

I have had to rework a few areas as I use UUIDs (technically ULIDs) rather than BigInts and split first name/last name for my users but looking at the code in JoelButcher\Socialstream\Http\Controllers\OAuthController.php it appears you have a method called "loginUser" but are calling $this->login($user); throughout the other methods - if I change:

protected function loginUser($user)

to

protected function login($user)

then everything works and the login session is completed successfully.

I'm hoping this is not an issue with my setup and is something that can be fixed in the package but your thoughts would be greatly appreciated.

@joelbutcher
Copy link
Owner

joelbutcher commented Jun 12, 2021

@mjdigital thanks for spot - Fixed in a patch release v3.1.1

@mjdigital
Copy link

@joelbutcher Great thanks, although I may have led you astray a little in my last message by not being specific enough. Although, as I stated, changing ->loginUser() to ->login() worked for me, it was just a quick test and you are still actually calling ->loginUser() on line 209 so either that needs changing to just ->login to match the updated login method or everything needs changing to ->loginUser() (except the actual call on the guard on line 252).

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants