Subversion-Projekte lars-tiefland.webanos.faltradxxs.de

Revision

Revision 125 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
118 lars 1
<?php
2
 
121 lars 3
    namespace App\Http\Controllers;
118 lars 4
 
121 lars 5
    use Illuminate\Http\Request;
124 lars 6
    use Illuminate\Support\Facades\Auth;
118 lars 7
 
121 lars 8
    class GoogleAuthenticatorController extends Controller
9
    {
10
        //
11
 
12
        public function create()
13
        {
123 lars 14
 
121 lars 15
            $google2fa = app( 'pragmarx.google2fa' );
126 lars 16
            $registration_data["email"] = auth()->user()->email;
125 lars 17
            if ( !auth()->user()->google2fa_secret )
123 lars 18
            {
19
                $registration_data["google2fa_secret"] = $google2fa->generateSecretKey();
20
            }
21
            else
22
            {
125 lars 23
                $registration_data["google2fa_secret"] = auth()->user()->google2fa_secret;
123 lars 24
            }
121 lars 25
            $QR_Image = $google2fa->getQRCodeInline(
26
                config( 'app.name' ),
27
                $registration_data['email'],
28
                $registration_data['google2fa_secret']
29
            );
123 lars 30
            return view( 'toolbox.ga', [
31
                'img'    => $QR_Image,
32
                'secret' => $registration_data['google2fa_secret']
121 lars 33
            ] );
34
        }
35
    }