source: app/Http/Middleware/CheckVerifyToken.php@ e651d0d

develop
Last change on this file since e651d0d was 1c25bcf, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

added 2fa, bug fixes, edited blades

  • Property mode set to 100644
File size: 712 bytes
RevLine 
[1c25bcf]1<?php
2
3namespace App\Http\Middleware;
4
5use App\Models\User;
6use App\Services\Hashid;
7use Closure;
8
9class CheckVerifyToken
10{
11 /**
12 * Handle an incoming request.
13 *
14 * @param \Illuminate\Http\Request $request
15 * @param \Closure $next
16 * @return mixed
17 */
18 public function handle($request, Closure $next)
19 {
20 $hashId = new Hashid();
21 $id = $request->route("id");
22 $token = $request->route("token");
23 $user = User::findOrFail($hashId->decode($id));
24
25 if ($user->verify_token !== $token || now()->greaterThan($user->updated_at->addMinutes(1))) {
26 return redirect()->route("auth.login");
27 }
28
29 return $next($request);
30 }
31}
Note: See TracBrowser for help on using the repository browser.