protected function getDefaultFormValues()
    {
        if ($this->formData) {
            return $this->formData;
        }

        if ($this->user->hasTwoFactor()) {
            $authKey = $this->user->getTwoFactorKey();

        } else {
            $authKey   = null;
        }

        if (! $authKey) {
            $authKey = $this->authenticator->createSecret();

            $this->addMessage(sprintf(
                    $this->_('A new random two factor key was saved for %s.'),
                    $this->user->getFullName()
                    ));

            $this->addMessage($this->_('Click save to enable two factor authentication.'));
            $this->user->setTwoFactorKey($this->authenticator, $authKey, false);

            // Set on save
            $output['twoFactorEnabled'] = 1;
        } else {
            $output['twoFactorEnabled'] = $this->user->isTwoFactorEnabled() ? 1 : 0;

            if (! $output['twoFactorEnabled']) {
                $this->addMessage($this->_('Two factor authentication not active!'));
            }
        }
        $output['twoFactorKey']     = $authKey;

        return $output;
    }
protected function getDefaultFormValues()
    {
        if ($this->formData) {
            return $this->formData;
        }

        if ($this->user->hasTwoFactor()) {
            $authKey = $this->user->getTwoFactorKey();

        } else {
            $authKey   = null;
        }

        if (! $authKey) {
            $authKey = $this->authenticator->createSecret();

            $this->addMessage(sprintf(
                    $this->_('A new random two factor key was saved for %s.'),
                    $this->user->getFullName()
                    ));

            $this->addMessage($this->_('Click save to enable two factor authentication.'));
            $this->user->setTwoFactorKey($this->authenticator, $authKey, false);

            // Set on save
            $output['twoFactorEnabled'] = 1;
        } else {
            $output['twoFactorEnabled'] = $this->user->isTwoFactorEnabled() ? 1 : 0;

            if (! $output['twoFactorEnabled']) {
                $this->addMessage($this->_('Two factor authentication not active!'));
            }
        }
        $output['twoFactorKey']     = $authKey;

        return $output;
    }
protected function getDefaultFormValues ( ) { if ( $ this -> formData ) { return $ this -> formData ; } if ( $ this -> user -> hasTwoFactor ( ) ) { $ authKey = $ this -> user -> getTwoFactorKey ( ) ; } else { $ authKey = null ; } if ( ! $ authKey ) { $ authKey = $ this -> authenticator -> createSecret ( ) ; $ this -> addMessage ( sprintf ( $ this -> _ ( 'A new random two factor key was saved for %s.' ) , $ this -> user -> getFullName ( ) ) ) ; $ this -> addMessage ( $ this -> _ ( 'Click save to enable two factor authentication.' ) ) ; $ this -> user -> setTwoFactorKey ( $ this -> authenticator , $ authKey , false ) ; // Set on save $ output [ 'twoFactorEnabled' ] = 1 ; } else { $ output [ 'twoFactorEnabled' ] = $ this -> user -> isTwoFactorEnabled ( ) ? 1 : 0 ; if ( ! $ output [ 'twoFactorEnabled' ] ) { $ this -> addMessage ( $ this -> _ ( 'Two factor authentication not active!' ) ) ; } } $ output [ 'twoFactorKey' ] = $ authKey ; return $ output ; }
Return the default values for the form

@return array
Return the default values for the form