Last change
on this file since 79aa35c was 0a1fb54, checked in by beratkjufliju <kufliju@…>, 3 years ago |
bug fixes
|
-
Property mode
set to
100644
|
File size:
817 bytes
|
Rev | Line | |
---|
[7304c7f] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Middleware;
|
---|
| 4 |
|
---|
| 5 | use Closure;
|
---|
| 6 | use App\Models\User;
|
---|
| 7 | use Illuminate\Support\Carbon;
|
---|
| 8 |
|
---|
| 9 | class 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.