magento-hackathon/Magento-Two-factor-Authentication

View on GitHub
src/app/design/frontend/base/default/template/twofactorauth/customer/configure.phtml

Summary

Maintainability
Test Coverage
<div class="page-title">
    <h1><?php echo $this->__('Two Factor Authentication') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php echo $this->getChildHtml('form_before')?>
<form action="<?php echo $this->getAction() ?>" method="post" id="twofactorauth-form">
    <input type="hidden" name="secret" value="<?php echo $this->getSecret(); ?>" />

    <div class="fieldset">
        <?php echo $this->getBlockHtml('formkey')?>
        <h2 class="legend"><?php echo $this->__('Settings') ?></h2>
        <ul class="form-list tfa__qr">
            <li class="control">
                <label for="enabled"><?php echo $this->__('Enable') ?></label>
                <select name="enabled" id="twofactorauth-enabled" class="tfa__enable">
                    <option value="0"><?php echo $this->__('No'); ?></option>
                    <option value="1" <?php if ($this->isEnabled()) { ?>selected="selected"<?php } ?>><?php echo $this->__('Yes'); ?></option>
                </select>
            </li>
        </ul>
    </div>
    <?php if(!Mage::getSingleton('customer/session')->getCustomer()->getTwofactorauthToken()): ?>
        <div class="fieldset"  id="twofactorauth-configure">
            <h2 class="legend"><?php echo $this->__('Configure') ?></h2>

            <p><?php echo $this->__('To configure a 2fa app, simply scan the QR code below and enter the code below.'); ?></p>

            <ul class="form-list tfa__qr">
                <li class="control">
                    <label><?php echo $this->__('QR code') ?></label>
                    <img src="<?php echo $this->getQrCodeImageUrl(); ?>" />
                </li>
                <li class="control">
                    <label ><?php echo $this->__('Verification code') ?></label>
                    <input type="text" name="code" value="" />
                </li>
            </ul>
        </div>
    <?php endif; ?>

    <div class="buttons-set">
         <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
         <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
    </div>

</form>