diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 62599c6c5..c7ee49235 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -278,4 +278,23 @@ class AccountController extends Controller return response()->json(['msg' => 'success'], 200); } + + public function sudoMode(Request $request) + { + return view('auth.sudo'); + } + + public function sudoModeVerify(Request $request) + { + $this->validate($request, [ + 'password' => 'required|string|max:500' + ]); + $user = Auth::user(); + $password = $request->input('password'); + $next = $request->cookie('redirectNext') ?:'/'; + if(password_verify($password, $user->password) === true) { + return redirect($next)->withCookie('sudoMode', time()); + } + return redirect($next); + } }