mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-18 00:13:12 +01:00
fd22b0bf58
V2 (Laravel re-make)
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Providers\RouteServiceProvider;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class ConfirmablePasswordController extends Controller
|
|
{
|
|
/**
|
|
* Show the confirm password view.
|
|
*
|
|
* @return \Illuminate\View\View
|
|
*/
|
|
public function show()
|
|
{
|
|
return view('auth.confirm-password');
|
|
}
|
|
|
|
/**
|
|
* Confirm the user's password.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return mixed
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
if (! Auth::guard('web')->validate([
|
|
'email' => $request->user()->email,
|
|
'password' => $request->password,
|
|
])) {
|
|
throw ValidationException::withMessages([
|
|
'password' => __('auth.password'),
|
|
]);
|
|
}
|
|
|
|
$request->session()->put('auth.password_confirmed_at', time());
|
|
|
|
return redirect()->intended(RouteServiceProvider::HOME);
|
|
}
|
|
}
|