First Commit
This commit is contained in:
commit
610aa1e202
4204 changed files with 636764 additions and 0 deletions
120
app/Http/Controllers/HomeController.php
Executable file
120
app/Http/Controllers/HomeController.php
Executable file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\SfGuardUser;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use Request;
|
||||
use Input;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
return redirect('home');
|
||||
|
||||
}
|
||||
|
||||
//login
|
||||
public function show()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
];
|
||||
return view('home', $data);
|
||||
}
|
||||
|
||||
|
||||
public function loadingModal(){
|
||||
|
||||
$data = Input::get('data');
|
||||
$target = Input::get('target');
|
||||
|
||||
$response = "";
|
||||
if($data == "data_protection"){
|
||||
$response = view('legal.data_protect_de')->render();
|
||||
}
|
||||
if($data == "imprint"){
|
||||
$response = view('legal.imprint_de')->render();
|
||||
}
|
||||
if(Request::ajax()) {
|
||||
return response()->json(['response' => $response, 'target'=>$target]);
|
||||
}
|
||||
abort(404);
|
||||
}
|
||||
|
||||
public function checkLogin($identify, $token)
|
||||
{
|
||||
if($identify){
|
||||
//user find by $identify
|
||||
$user = User::where('identify', '=', $identify)->first();
|
||||
if(!$user){
|
||||
return abort(404);
|
||||
}
|
||||
//user - check für from $sf_guard_user - old system
|
||||
$sf_guard_user = SfGuardUser::where('identify', '=', $identify)->first();
|
||||
if(!$sf_guard_user){
|
||||
return abort(404);
|
||||
}
|
||||
if($user->id != $sf_guard_user->user_id){
|
||||
return abort(404);
|
||||
|
||||
}
|
||||
if($sf_guard_user->token != $token){
|
||||
return abort(404);
|
||||
}
|
||||
$time = Carbon::parse($sf_guard_user->token_at);
|
||||
$now = Carbon::now();
|
||||
$duration = $time->diffInSeconds($now);
|
||||
|
||||
if($duration > 3){
|
||||
return abort(404);
|
||||
}
|
||||
$sf_guard_user->token = null;
|
||||
$sf_guard_user->token_at = null;
|
||||
$sf_guard_user->save();
|
||||
if(!Auth::check()){
|
||||
$user->last_login = now();
|
||||
$user->save();
|
||||
Auth::login($user);
|
||||
}
|
||||
if(Auth::check()){
|
||||
return redirect('/templates');
|
||||
}
|
||||
}
|
||||
return abort(404);
|
||||
}
|
||||
|
||||
public function legalDataProtected()
|
||||
{
|
||||
return view('legal.data_protected');
|
||||
}
|
||||
|
||||
public function legalImprint()
|
||||
{
|
||||
return view('legal.imprint');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue