|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* NOTICE OF LICENSE |
|
5
|
|
|
* |
|
6
|
|
|
* Part of the Rinvex Fort Package. |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to The MIT License (MIT) |
|
9
|
|
|
* that is bundled with this package in the LICENSE file. |
|
10
|
|
|
* |
|
11
|
|
|
* Package: Rinvex Fort Package |
|
12
|
|
|
* License: The MIT License (MIT) |
|
13
|
|
|
* Link: https://rinvex.com |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace Rinvex\Fort\Http\Controllers\Frontend; |
|
17
|
|
|
|
|
18
|
|
|
use Illuminate\Support\Facades\Auth; |
|
19
|
|
|
use Illuminate\Support\Facades\Lang; |
|
20
|
|
|
use Rinvex\Fort\Contracts\UserRepositoryContract; |
|
21
|
|
|
use Rinvex\Fort\Http\Controllers\AbstractController; |
|
22
|
|
|
|
|
23
|
|
|
class ManagePersistenceController extends AbstractController |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Create a new account controller instance. |
|
27
|
|
|
* |
|
28
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $users |
|
29
|
|
|
* |
|
30
|
|
|
* @return void |
|
|
|
|
|
|
31
|
|
|
*/ |
|
32
|
|
|
public function __construct(UserRepositoryContract $users) |
|
|
|
|
|
|
33
|
|
|
{ |
|
34
|
|
|
$this->middleware($this->getAuthMiddleware(), ['except' => $this->middlewareWhitelist]); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Show the account sessions. |
|
39
|
|
|
* |
|
40
|
|
|
* @return \Illuminate\Http\Response |
|
|
|
|
|
|
41
|
|
|
*/ |
|
42
|
|
|
public function showPersistence() |
|
43
|
|
|
{ |
|
44
|
|
|
return view('rinvex.fort::profile.persistence'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Flush the given session. |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $token |
|
|
|
|
|
|
51
|
|
|
* |
|
52
|
|
|
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse |
|
53
|
|
|
*/ |
|
54
|
|
|
public function processPersistenceFlush($token = null) |
|
55
|
|
|
{ |
|
56
|
|
|
$status = ''; |
|
57
|
|
|
|
|
58
|
|
|
if ($token) { |
|
|
|
|
|
|
59
|
|
|
app('rinvex.fort.persistence')->delete($token); |
|
60
|
|
|
$status = Lang::get('rinvex.fort::message.auth.session.flushed'); |
|
61
|
|
|
} elseif (request()->get('confirm')) { |
|
62
|
|
|
app('rinvex.fort.persistence')->deleteByUser(Auth::guard($this->getGuard())->user()->id); |
|
63
|
|
|
$status = Lang::get('rinvex.fort::message.auth.session.flushedall'); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
return intend([ |
|
67
|
|
|
'back' => true, |
|
68
|
|
|
'with' => ['rinvex.fort.alert.warning' => $status], |
|
69
|
|
|
]); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.