Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions code/site/libraries/authentication/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public function authenticate()

$username = $app->input->post->get('username', '', 'STRING');
$password = $app->input->post->get('password', '', 'STRING');
$secret = $app->input->post->get('secretkey', '', 'STRING');

$userId = $this->loadUserByCredentials($username, $password);

// Remove username and password from request for when it gets logged
$uri = JFactory::getURI();
$uri->delVar('username');
$uri->delVar('password');
$uri->delVar('secretkey');

if ($userId === false)
{
Expand All @@ -57,18 +59,22 @@ public function authenticate()
*
* @param STRING $user user
* @param STRING $pass pass
* @param STRING $secret secretkey
*
* @return int
*
* @since 1.6
*/
public function loadUserByCredentials($user, $pass)
public function loadUserByCredentials($user, $pass, $secret = NULL)
{
jimport('joomla.user.authentication');

$authenticate = JAuthentication::getInstance();

$response = $authenticate->authenticate(array('username' => $user, 'password' => $pass), $options = array());
// $response = $authenticate->authenticate(array('username' => $user, 'password' => $pass), $options = array());
// adding support for two factor authentication

$response = $authenticate->authenticate(array('username' => $user, 'password' => $pass, 'secretkey' => $secret), $options = array());

if ($response->status === JAuthentication::STATUS_SUCCESS)
{
Expand Down