Move User model to Models/
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
@@ -58,13 +59,13 @@ class RegisterController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return User
|
||||
*/
|
||||
protected function create(array $data): User
|
||||
{
|
||||
$fields = [
|
||||
'name' => $data['name'],
|
||||
|
@@ -7,13 +7,13 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\SocialLink;
|
||||
use App\Models\Oauth;
|
||||
use App\Models\AccountOauth;
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
|
||||
class SocialLoginController extends Controller
|
||||
{
|
||||
@@ -31,18 +31,15 @@ class SocialLoginController extends Controller
|
||||
// See if this user has connected and linked previously
|
||||
$aoo = $oo->accounts->where('userid',$openiduser->id);
|
||||
|
||||
if ($aoo->count() == 1)
|
||||
{
|
||||
if ($aoo->count() == 1) {
|
||||
$aoo = $aoo->first();
|
||||
|
||||
if ((is_null($user=$aoo->user) AND (is_null($aoo->account) OR is_null($user=$aoo->account->user))) OR ! $user->active)
|
||||
{
|
||||
if ((is_null($user=$aoo->user) AND (is_null($aoo->account) OR is_null($user=$aoo->account->user))) OR ! $user->active) {
|
||||
if (! $user) {
|
||||
$user = User::where('email',$openiduser->email)->first();
|
||||
}
|
||||
|
||||
if (! $user OR ! $user->active)
|
||||
{
|
||||
if (! $user OR ! $user->active) {
|
||||
return redirect('/login')->with('error','Invalid account, or account inactive, please contact an admin.');
|
||||
}
|
||||
|
||||
@@ -61,8 +58,7 @@ class SocialLoginController extends Controller
|
||||
$uo = User::active()->where('email',$openiduser->email);
|
||||
|
||||
// See if their is an account with this email address
|
||||
if ($uo->count() == 1)
|
||||
{
|
||||
if ($uo->count() == 1) {
|
||||
$aoo = new AccountOauth;
|
||||
$aoo->userid = $openiduser->id;
|
||||
$aoo->oauth_data = $openiduser->user;
|
||||
@@ -70,7 +66,7 @@ class SocialLoginController extends Controller
|
||||
|
||||
return $this->link($provider,$aoo,$uo->first());
|
||||
|
||||
// If there are too many users, then we have a problem
|
||||
// If there are too many users, then we have a problem
|
||||
} elseif ($uo->count() > 1) {
|
||||
return redirect('/login')->with('error','Seems you have multiple accounts, please contact an admin.');
|
||||
|
||||
|
Reference in New Issue
Block a user