2020-04-09 13:05:23 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
2021-08-03 16:24:49 +02:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
2020-04-09 13:05:23 +02:00
|
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Show the application dashboard.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
|
|
|
*/
|
2020-04-17 09:18:42 +02:00
|
|
|
public function index(Request $request)
|
2020-04-09 13:05:23 +02:00
|
|
|
{
|
2022-06-13 15:49:59 +02:00
|
|
|
// $secret = Totp::GenerateSecret(16);
|
|
|
|
|
// Display new key to user so they can enter it in Google Authenticator or Authy
|
|
|
|
|
// echo strtoupper(Base32::encode($secret));exit;
|
2021-08-03 16:24:49 +02:00
|
|
|
// otpauth://totp/LDC%20WEB:mail@ldc.fr?secret=secret&issuer=LDC%20WEB
|
2020-04-09 13:05:23 +02:00
|
|
|
return view('home');
|
|
|
|
|
}
|
2021-08-03 16:24:49 +02:00
|
|
|
|
|
|
|
|
public function qr()
|
|
|
|
|
{
|
2022-06-13 15:49:59 +02:00
|
|
|
$user = Auth::user();
|
|
|
|
|
$qrcode = QrCode::size(200)->generate("otpauth://totp/LDC%20WEB:" . $user->email . "?secret=" . $user->totp_secret . "&issuer=LDC%20WEB");
|
2021-08-03 16:24:49 +02:00
|
|
|
return view("qrcode", compact('qrcode'));
|
|
|
|
|
}
|
2020-04-09 13:05:23 +02:00
|
|
|
}
|