mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 08:17:32 -05:00 
			
		
		
		
	Fixes for 2FA
This commit is contained in:
		
							parent
							
								
									1934443bff
								
							
						
					
					
						commit
						8f37a06e24
					
				@ -47,11 +47,13 @@ class TwoFactorController extends BaseController
 | 
			
		||||
 | 
			
		||||
    public function enableTwoFactor()
 | 
			
		||||
    {
 | 
			
		||||
        $google2fa = new Google2FA();
 | 
			
		||||
 | 
			
		||||
        $user = auth()->user();
 | 
			
		||||
        $secret = request()->input('secret');
 | 
			
		||||
        $oneTimePassword = request()->input('one_time_password');
 | 
			
		||||
 | 
			
		||||
        if (! $secret || ! Google2FA::verifyKey($secret, $oneTimePassword)) {
 | 
			
		||||
        if (! $secret || ! $google2fa->verifyKey($secret, $oneTimePassword)) {
 | 
			
		||||
            return response()->json('message' > ctrans('texts.invalid_one_time_password'));
 | 
			
		||||
        } elseif (! $user->google_2fa_secret && $user->phone && $user->confirmed) {
 | 
			
		||||
            $user->google_2fa_secret = encrypt($secret);
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,7 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Models;
 | 
			
		||||
 | 
			
		||||
use App\Services\BillingSubscription\BillingSubscriptionService;
 | 
			
		||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
 | 
			
		||||
use Illuminate\Database\Eloquent\Model;
 | 
			
		||||
use Illuminate\Database\Eloquent\SoftDeletes;
 | 
			
		||||
@ -53,6 +54,11 @@ class BillingSubscription extends BaseModel
 | 
			
		||||
        'deleted_at' => 'timestamp',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    public function service()
 | 
			
		||||
    {
 | 
			
		||||
        return new BillingSubscriptionService($this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
 | 
			
		||||
    {
 | 
			
		||||
        return $this->belongsTo(Company::class);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user