source: app/Http/Middleware/CheckCreatePassword.php@ 1e31937

Last change on this file since 1e31937 was 0a1fb54, checked in by beratkjufliju <kufliju@…>, 3 years ago

bug fixes

  • Property mode set to 100644
File size: 817 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) {
[0a1fb54]26 return redirect()->route("auth.showLogin");
[7304c7f]27 }
28
29 if(!$user->is_forgot_password) {
[0a1fb54]30 if(Carbon::now()->greaterThan($user->created_at->addMinutes(180))) {
31 return redirect()->route("auth.showLogin");
[7304c7f]32 }
33 }
34
35 return $next($request);
36 }
37}
Note: See TracBrowser for help on using the repository browser.