test
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • stevenwillettcom Friend
    #883621

    So I have tried the following:

    <?php if (count($twofactormethods) > 1) : ?>  
         <div class="wrap-input"> 
              <p id="form-login-authentication"> 
                   <label for="authentication"><?php echo JText::_('JGLOBAL_SECRETKEY') ?></label>
                   <input name="secretkey" id="authentication" type="text" class="inputbox" alt="Authentication" size="18" placeholder="<?php echo JText::_('JGLOBAL_SECRETKEY') ?>"> 
              </p>                              
         </div>  
    <?php endif; ?> 

    This did not work, any ideas on what I might be missing?

    Its not getting past the opening check

    <?php if (count($twofactormethods) > 1) : ?>

    The field does not render but a simple

    <p>Test</p>

    outside of this does if I include it in the offline.php file.

    Am I missing an include file maybe?

    Saguaros Moderator
    #883929
    stevenwillettcom Friend
    #884695

    ANSWER / SOLUTION

    Do the following:

    1) Open offline.php (typically located here: ./templates/ja_sugite/offline.php)

    2) Now near the very top of offline.php you need to find:

    defined('_JEXEC') or die;
    $app = JFactory::getApplication();

    Immediately after

    $app = JFactory::getApplication();

    Add the following two lines

    require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
    $twofactormethods = UsersHelper::getTwoFactorMethods();
    

    3) Now locate the following block of code:

    <div id="form-login-password" class="form-group" >
    <label class="control-label" for="passwd"><?php echo JText::_('JGLOBAL_PASSWORD') ?></label>
    <input class="control-input" type="password" name="password" class="inputbox" size="18" alt="<?php echo JText::_('JGLOBAL_PASSWORD') ?>" id="passwd"/>
    </div>

    4) Immediately after the closing </ div > tag (without spaces) add the following code:

    <?php if (count($twofactormethods) > 1) : ?>
    <div id="form-secretkey" class="form-group" >
    <label class="control-label" for="secretkey"><?php echo JText::_('JGLOBAL_SECRETKEY') ?></label>
    <input class="control-input" type="text" name="secretkey" size="18" alt="<?php echo JText::_('JGLOBAL_SECRETKEY') ?>" id="secretkey" />
    </div>
    <?php endif; ?>

    Note: Line 1 conditionally checks if two factor authentication is actually being used, so no need to worry about this showing for all users / scenarios, only those you have set to use two factor authentication will see this field.

    And that’s it, save the file, FTP this to your server and refresh your offline login page to see the results.

    CREDIT: Saguaros for identifying the two lines at the start of the file needed, this is what I was missing.

    Thank you Saguaros.

    Saguaros Moderator
    #884831

    Glad to hear it’s ok now!!!

Viewing 5 posts - 1 through 5 (of 5 total)

This topic contains 4 replies, has 2 voices, and was last updated by  Saguaros 8 years, 11 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum