public function addSetupFormElements(\Zend_Form $form, \Gems_User_User $user, array &$formData)
    {
        $name  = $user->getLoginName();
        $title = $this->project->getName() . ' - GemsTracker';

        $params['alt']    = $this->_('QR Code');
        $params['class']  = 'floatLeft';
        $params['height'] = 200;
        $params['width']  = 200;
        $params['src']    = \MUtil_Html::raw($this->_getQRCodeGoogleUrl(
                $name,
                $formData['twoFactorKey'],
                $title,
                $params
                ));
        // \MUtil_Echo::track($params);

        $imgElement = $form->createElement('Html', 'image');
        $imgElement->setLabel($this->_('Scan this QR Code'))
                ->setDescription($this->_('Install the Google Authenticator app on your phone and scan this code.'));
        $imgElement->img($params);
        $form->addElement($imgElement);

        if ($user->canSaveTwoFactorKey()) {
            $orElement = $form->createElement('Html', 'orelem');
            $orElement->setLabel($this->_('or'));
            $form->addElement($orElement);

            $options = [
                'label' => $this->_('Enter new authenticator code'),
                'description' => $this->_('An uppercase string containing A through Z, 2 to 7 and maybe = at the end.'),
                'maxlength' => 16,
                'minlength' => 16,
                'required'  => true,
                'size'      => 30,
                ];

            $keyElement = $form->createElement('Text', 'twoFactorKey', $options);
            $keyElement->addFilter('StringToUpper')
                    ->addValidator('Base32')
                    ->addValidator('StringLength', true, ['min' => 16, 'max' => 16]);

            $form->addElement($keyElement);
        }
    }
public function addSetupFormElements(\Zend_Form $form, \Gems_User_User $user, array &$formData)
    {
        $name  = $user->getLoginName();
        $title = $this->project->getName() . ' - GemsTracker';

        $params['alt']    = $this->_('QR Code');
        $params['class']  = 'floatLeft';
        $params['height'] = 200;
        $params['width']  = 200;
        $params['src']    = \MUtil_Html::raw($this->_getQRCodeGoogleUrl(
                $name,
                $formData['twoFactorKey'],
                $title,
                $params
                ));
        // \MUtil_Echo::track($params);

        $imgElement = $form->createElement('Html', 'image');
        $imgElement->setLabel($this->_('Scan this QR Code'))
                ->setDescription($this->_('Install the Google Authenticator app on your phone and scan this code.'));
        $imgElement->img($params);
        $form->addElement($imgElement);

        if ($user->canSaveTwoFactorKey()) {
            $orElement = $form->createElement('Html', 'orelem');
            $orElement->setLabel($this->_('or'));
            $form->addElement($orElement);

            $options = [
                'label' => $this->_('Enter new authenticator code'),
                'description' => $this->_('An uppercase string containing A through Z, 2 to 7 and maybe = at the end.'),
                'maxlength' => 16,
                'minlength' => 16,
                'required'  => true,
                'size'      => 30,
                ];

            $keyElement = $form->createElement('Text', 'twoFactorKey', $options);
            $keyElement->addFilter('StringToUpper')
                    ->addValidator('Base32')
                    ->addValidator('StringLength', true, ['min' => 16, 'max' => 16]);

            $form->addElement($keyElement);
        }
    }
public function addSetupFormElements ( \ Zend_Form $ form , \ Gems_User_User $ user , array & $ formData ) { $ name = $ user -> getLoginName ( ) ; $ title = $ this -> project -> getName ( ) . ' - GemsTracker' ; $ params [ 'alt' ] = $ this -> _ ( 'QR Code' ) ; $ params [ 'class' ] = 'floatLeft' ; $ params [ 'height' ] = 200 ; $ params [ 'width' ] = 200 ; $ params [ 'src' ] = \ MUtil_Html :: raw ( $ this -> _getQRCodeGoogleUrl ( $ name , $ formData [ 'twoFactorKey' ] , $ title , $ params ) ) ; // \MUtil_Echo::track($params); $ imgElement = $ form -> createElement ( 'Html' , 'image' ) ; $ imgElement -> setLabel ( $ this -> _ ( 'Scan this QR Code' ) ) -> setDescription ( $ this -> _ ( 'Install the Google Authenticator app on your phone and scan this code.' ) ) ; $ imgElement -> img ( $ params ) ; $ form -> addElement ( $ imgElement ) ; if ( $ user -> canSaveTwoFactorKey ( ) ) { $ orElement = $ form -> createElement ( 'Html' , 'orelem' ) ; $ orElement -> setLabel ( $ this -> _ ( 'or' ) ) ; $ form -> addElement ( $ orElement ) ; $ options = [ 'label' => $ this -> _ ( 'Enter new authenticator code' ) , 'description' => $ this -> _ ( 'An uppercase string containing A through Z, 2 to 7 and maybe = at the end.' ) , 'maxlength' => 16 , 'minlength' => 16 , 'required' => true , 'size' => 30 , ] ; $ keyElement = $ form -> createElement ( 'Text' , 'twoFactorKey' , $ options ) ; $ keyElement -> addFilter ( 'StringToUpper' ) -> addValidator ( 'Base32' ) -> addValidator ( 'StringLength' , true , [ 'min' => 16 , 'max' => 16 ] ) ; $ form -> addElement ( $ keyElement ) ; } }
Add the elements to the setup form

@param \Zend_Form $form
@param \Gems_User_User $user The user to setup for
@param array $formData Current form data
Add the elements to the setup form