Update AccountController

This commit is contained in:
Daniel Supernault 2018-09-09 14:22:15 -06:00
parent ea88fd60b3
commit 336deae05b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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);
}
}