source: app/Http/Middleware/CheckCreatePassword.php@ b375b43

develop
Last change on this file since b375b43 was 7304c7f, checked in by beratkjufliju <kufliju@…>, 3 years ago

added user authentication, create & forgot password methods and blades

  • Property mode set to 100644
File size: 816 bytes
RevLine 
[7304c7f]1<?php
2
3namespace App\Http\Middleware;
4
5use Closure;
6use App\Models\User;
7use Illuminate\Support\Carbon;
8
9class CheckCreatePassword
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 $id = $request->route("id");
21 $token = $request->route("token");
22
23 $user = User::findOrFail($id);
24
25 if($user->is_active) {
26 return redirect()->route("auth.loginShow");
27 }
28
29 if(!$user->is_forgot_password) {
30 if(Carbon::now()->greaterThan($user->created_at->addMinutes(10))) {
31 return redirect()->route("auth.loginShow");
32 }
33 }
34
35 return $next($request);
36 }
37}
Note: See TracBrowser for help on using the repository browser.