-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2250 from codeeu/dev
Dev
- Loading branch information
Showing
108 changed files
with
8,983 additions
and
10,662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class ConsentController extends Controller | ||
{ | ||
public function show() | ||
{ | ||
return view('consent'); | ||
} | ||
|
||
public function store(Request $request) | ||
{ | ||
$user = Auth::user(); | ||
|
||
if ($request->input('consent1') === '1') { | ||
//$user->consent_given_at = now(); | ||
$user->giveConsent(); | ||
if ($request->input('consent2') === '1') { | ||
$user->giveFutureConsent(); | ||
} | ||
|
||
return redirect()->route('home'); | ||
} | ||
|
||
Auth::logout(); | ||
return redirect('/'); | ||
} | ||
|
||
public function logout() | ||
{ | ||
Auth::logout(); | ||
return redirect('/login'); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class CheckConsent | ||
{ | ||
public function handle($request, Closure $next) | ||
{ | ||
$excludedRoutes = [ | ||
'consent.show', | ||
'consent.store', | ||
'consent.logout', | ||
]; | ||
|
||
if (Auth::check() && !Auth::user()->hasGivenConsent()) { | ||
if (!in_array($request->route()->getName(), $excludedRoutes)) { | ||
return redirect()->route('consent.show'); | ||
} | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.