toggleTwoFactor() public method

Save the user's two-factor-authentication preferences
public toggleTwoFactor ( integer $userID, array $post ) : boolean
$userID integer
$post array
return boolean
Example #1
0
 /**
  * @route my/account/2-factor
  */
 public function twoFactorSetup()
 {
     if (!$this->isLoggedIn()) {
         \Airship\redirect($this->airship_cabin_prefix);
     }
     $this->twoFactorPreamble();
     $userID = $this->getActiveUserId();
     $post = $this->post(new TwoFactorFilter());
     if ($post) {
         if ($this->acct->toggleTwoFactor($userID, $post)) {
             \Airship\redirect($this->airship_cabin_prefix . '/my/account/2-factor');
         }
     }
     $user = $this->acct->getUserAccount($userID);
     $this->lens('two_factor', ['active_link' => 'bridge-link-two-factor', 'enabled' => $user['enable_2factor'] ?? false]);
 }