Skip to content

Commit

Permalink
check for feature
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 14, 2020
1 parent 9ebb099 commit c1ff4a5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Http/Livewire/TwoFactorAuthenticationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Laravel\Fortify\Actions\DisableTwoFactorAuthentication;
use Laravel\Fortify\Actions\EnableTwoFactorAuthentication;
use Laravel\Fortify\Actions\GenerateNewRecoveryCodes;
use Laravel\Fortify\Features;
use Laravel\Jetstream\ConfirmsPasswords;
use Livewire\Component;

Expand Down Expand Up @@ -35,7 +36,9 @@ class TwoFactorAuthenticationForm extends Component
*/
public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $enable)
{
$this->ensurePasswordIsConfirmed();
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
$this->ensurePasswordIsConfirmed();
}

$enable(Auth::user());

Expand All @@ -50,7 +53,9 @@ public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $ena
*/
public function showRecoveryCodes()
{
$this->ensurePasswordIsConfirmed();
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
$this->ensurePasswordIsConfirmed();
}

$this->showingRecoveryCodes = true;
}
Expand All @@ -63,7 +68,9 @@ public function showRecoveryCodes()
*/
public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate)
{
$this->ensurePasswordIsConfirmed();
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
$this->ensurePasswordIsConfirmed();
}

$generate(Auth::user());

Expand All @@ -78,7 +85,9 @@ public function regenerateRecoveryCodes(GenerateNewRecoveryCodes $generate)
*/
public function disableTwoFactorAuthentication(DisableTwoFactorAuthentication $disable)
{
$this->ensurePasswordIsConfirmed();
if (Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')) {
$this->ensurePasswordIsConfirmed();
}

$disable(Auth::user());
}
Expand Down

0 comments on commit c1ff4a5

Please sign in to comment.