mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
commit
bcdb264345
@ -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…
Reference in New Issue
Block a user