Tagged: 2 Factor Authentication, JA Sugite, Login Form, Offline Form
-
AuthorPosts
-
stevenwillettcom Friend
stevenwillettcom
- Join date:
- August 2014
- Posts:
- 10
- Downloads:
- 28
- Uploads:
- 1
- Thanks:
- 3
- Thanked:
- 1 times in 1 posts
February 15, 2016 at 2:58 pm #883605Hi,
I have noticed today that when 2 factor authentication is enabled the offline login form (and possibly others) do not include the field to cater for this feature introduced in J3.2 I believe it was.
I am trying to identify a solution, so far the best I can come up with is the following with a little adaptation still needed I suspect to work.
<?php if (count($twofactormethods) > 1) : ?> <div class="wrap-input"> <p id="form-login-authentication"> <label for="authentication">Authenticate</label> <input name="secretkey" id="authentication" type="text" class="inputbox" alt="Authentication" size="18" placeholder="<?php echo JText::_('JGLOBAL_SECRETKEY') ?>"> </div> <?php endif; ?>
Any other suggestions? Is this already included, but I have missed a setting maybe?
Code Snippet Credit: https://yootheme.com/support/question/63848
Thanks in advance.
stevenwillettcom Friendstevenwillettcom
- Join date:
- August 2014
- Posts:
- 10
- Downloads:
- 28
- Uploads:
- 1
- Thanks:
- 3
- Thanked:
- 1 times in 1 posts
February 15, 2016 at 3:29 pm #883621So 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 ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
February 16, 2016 at 2:41 am #883929Hi
You can take a look at this topic: https://www.joomlart.com/forums/topic/authentication-on-site-offline-page/
1 user says Thank You to Saguaros for this useful post
stevenwillettcom Friendstevenwillettcom
- Join date:
- August 2014
- Posts:
- 10
- Downloads:
- 28
- Uploads:
- 1
- Thanks:
- 3
- Thanked:
- 1 times in 1 posts
February 16, 2016 at 9:03 pm #884695ANSWER / 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.
-
AuthorPosts
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