Update laravel framework from 9 to 11, removed some old packages
This commit is contained in:
@@ -4,8 +4,6 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
@@ -21,29 +19,4 @@ class ForgotPasswordController extends Controller
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
public function showLinkRequestForm()
|
||||
{
|
||||
return view('adminlte::auth.passwords.email');
|
||||
}
|
||||
|
||||
public function sendResetLinkEmail(Request $request)
|
||||
{
|
||||
$this->validateEmail($request);
|
||||
|
||||
// If the account is not active, or doesnt exist, we'll send a fake "sent" message.
|
||||
if (! ($x=$this->broker()->getUser($this->credentials($request))) || (! $x->active))
|
||||
return $this->sendResetLinkResponse($request, Password::RESET_LINK_SENT);
|
||||
|
||||
// We will send the password reset link to this user. Once we have attempted
|
||||
// to send the link, we will examine the response then see the message we
|
||||
// need to show to the user. Finally, we'll send out a proper response.
|
||||
$response = $this->broker()->sendResetLink(
|
||||
$this->credentials($request)
|
||||
);
|
||||
|
||||
return $response == Password::RESET_LINK_SENT
|
||||
? $this->sendResetLinkResponse($request, $response)
|
||||
: $this->sendResetLinkFailedResponse($request, $response);
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,6 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -12,35 +10,36 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth')
|
||||
->only('logout');
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
@@ -73,6 +72,7 @@ class LoginController extends Controller
|
||||
if (file_exists('login_note.txt'))
|
||||
$login_note = file_get_contents('login_note.txt');
|
||||
|
||||
return view('adminlte::auth.login')->with('login_note',$login_note);
|
||||
return view('adminlte::auth.login')
|
||||
->with('login_note',$login_note);
|
||||
}
|
||||
}
|
||||
|
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'min:3', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
'token' => 'required|doorman:email',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return User
|
||||
*/
|
||||
protected function create(array $data): User
|
||||
{
|
||||
$fields = [
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
];
|
||||
|
||||
if (config('auth.providers.users.field','email') === 'username' && isset($data['username'])) {
|
||||
$fields['username'] = $data['username'];
|
||||
}
|
||||
|
||||
try {
|
||||
Doorman::redeem($data['token'],$data['email']);
|
||||
|
||||
// @todo Want to direct or display an appropriate error message (although the form validation does it anyway).
|
||||
} catch (DoormanException $e) {
|
||||
redirect('/error');
|
||||
abort(403);
|
||||
}
|
||||
|
||||
return User::create($fields);
|
||||
}
|
||||
}
|
@@ -3,9 +3,7 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
@@ -27,22 +25,5 @@ class ResetPasswordController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
public function showResetForm(Request $request, $token = null)
|
||||
{
|
||||
return view('adminlte::auth.passwords.reset')->with(
|
||||
['token' => $token, 'email' => $request->email]
|
||||
);
|
||||
}
|
||||
}
|
||||
protected $redirectTo = '/home';
|
||||
}
|
||||
|
@@ -12,13 +12,13 @@ use Laravel\Socialite\Facades\Socialite;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\SocialLink;
|
||||
use App\Models\{ProviderOauth,ProviderToken,User,UserOauth};
|
||||
use App\Providers\RouteServiceProvider;
|
||||
|
||||
class SocialLoginController extends Controller
|
||||
{
|
||||
public function redirectToProvider($provider)
|
||||
{
|
||||
return Socialite::with($provider)->redirect();
|
||||
return Socialite::with($provider)
|
||||
->redirect();
|
||||
}
|
||||
|
||||
public function handleProviderCallback($provider)
|
||||
@@ -77,7 +77,8 @@ class SocialLoginController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->intended(RouteServiceProvider::HOME);
|
||||
return redirect()
|
||||
->intended('/home');
|
||||
}
|
||||
|
||||
public function handleBearerTokenCallback($provider)
|
||||
@@ -101,7 +102,7 @@ class SocialLoginController extends Controller
|
||||
$po->tokens()->save($uoo);
|
||||
|
||||
return redirect()
|
||||
->intended(RouteServiceProvider::HOME)
|
||||
->intended('/home')
|
||||
->with('success','Token refreshed.');
|
||||
}
|
||||
|
||||
@@ -141,8 +142,9 @@ class SocialLoginController extends Controller
|
||||
|
||||
$aoo->user_id = $uo->id;
|
||||
$aoo->save();
|
||||
Auth::login($uo,FALSE);
|
||||
Auth::login($uo);
|
||||
|
||||
return redirect()->intended(RouteServiceProvider::HOME);
|
||||
return redirect()
|
||||
->intended('/home');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user