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

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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