develop
Last change
on this file since 69dd35e 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
|
Line | |
---|
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) {
|
---|
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.