Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\MFA\Authy;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -86,7 +86,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
{
|
||||
/* Asking for a text or call instead? */
|
||||
$availableMethods = explode( ',', \IPS\Settings::i()->authy_setup );
|
||||
if ( isset( \IPS\Request::i()->authy_method ) and $mfaDetails['authy']['setupMethod'] == 'authy' and in_array( \IPS\Request::i()->authy_method, $availableMethods ) )
|
||||
if ( isset( \IPS\Request::i()->authy_method ) and $mfaDetails['authy']['setupMethod'] == 'authy' and \in_array( \IPS\Request::i()->authy_method, $availableMethods ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -166,7 +166,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
}
|
||||
catch ( Exception $e )
|
||||
{
|
||||
if ( in_array( $e->getCode(), array( Exception::TOKEN_REUSED, Exception::TOKEN_INVALID ) ) )
|
||||
if ( \in_array( $e->getCode(), array( Exception::TOKEN_REUSED, Exception::TOKEN_INVALID ) ) )
|
||||
{
|
||||
$_SESSION['authyAuthError'] = $e->getUserMessage();
|
||||
}
|
||||
@@ -196,7 +196,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
|
||||
/* Call Authy */
|
||||
$availableMethods = explode( ',', \IPS\Settings::i()->authy_setup );
|
||||
$method = ( isset( \IPS\Request::i()->method ) and in_array( \IPS\Request::i()->method, $availableMethods ) ) ? \IPS\Request::i()->method : array_shift( $availableMethods );
|
||||
$method = ( isset( \IPS\Request::i()->method ) and \in_array( \IPS\Request::i()->method, $availableMethods ) ) ? \IPS\Request::i()->method : array_shift( $availableMethods );
|
||||
$_SESSION['authyConfigureError'] = NULL;
|
||||
try
|
||||
{
|
||||
@@ -230,7 +230,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
}
|
||||
catch ( Exception $e )
|
||||
{
|
||||
if ( in_array( $e->getCode(), array( Exception::USER_INVALID, Exception::PHONE_NUMBER_INVALID ) ) )
|
||||
if ( \in_array( $e->getCode(), array( Exception::USER_INVALID, Exception::PHONE_NUMBER_INVALID ) ) )
|
||||
{
|
||||
$_SESSION['authyConfigureError'] = $e->getUserMessage();
|
||||
}
|
||||
@@ -297,19 +297,19 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
}
|
||||
|
||||
/* If Authy app is one of the available options... */
|
||||
if ( in_array( 'authy', $availableMethods ) )
|
||||
if ( \in_array( 'authy', $availableMethods ) )
|
||||
{
|
||||
/* Are we getting a onetouch status? */
|
||||
if ( \IPS\Request::i()->onetouchCheck and \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( array( 'status' => intval( $this->_onetouchCheck( $member, \IPS\Request::i()->onetouchCheck ) ) ) );
|
||||
\IPS\Output::i()->json( array( 'status' => \intval( $this->_onetouchCheck( $member, \IPS\Request::i()->onetouchCheck ) ) ) );
|
||||
}
|
||||
|
||||
/* If it is not the only option... */
|
||||
if ( count( $availableMethods ) > 1 )
|
||||
if ( \count( $availableMethods ) > 1 )
|
||||
{
|
||||
/* If they have asked for a text/call instead, do that */
|
||||
if ( !isset( $mfaDetails['authy']['sent'] ) and isset( \IPS\Request::i()->authy_method ) and in_array( \IPS\Request::i()->authy_method, $availableMethods ) )
|
||||
if ( !isset( $mfaDetails['authy']['sent'] ) and isset( \IPS\Request::i()->authy_method ) and \in_array( \IPS\Request::i()->authy_method, $availableMethods ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -368,7 +368,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
}
|
||||
|
||||
/* If text message is the only available option, or we have chosen that option, do that... */
|
||||
if ( in_array( 'sms', $availableMethods ) and ( count( $availableMethods ) == 1 ) or ( isset( $mfaDetails['authy']['sent'] ) and $mfaDetails['authy']['sent']['method'] == 'sms' ) or ( isset( \IPS\Request::i()->authy_method ) and \IPS\Request::i()->authy_method == 'sms' ) )
|
||||
if ( \in_array( 'sms', $availableMethods ) and ( \count( $availableMethods ) == 1 ) or ( isset( $mfaDetails['authy']['sent'] ) and $mfaDetails['authy']['sent']['method'] == 'sms' ) or ( isset( \IPS\Request::i()->authy_method ) and \IPS\Request::i()->authy_method == 'sms' ) )
|
||||
{
|
||||
/* Send the text if we haven't already */
|
||||
if ( !isset( $mfaDetails['authy']['sent'] ) )
|
||||
@@ -418,7 +418,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
}
|
||||
|
||||
/* Otherwise we're going to show a screen */
|
||||
return \IPS\Theme::i()->getTemplate( 'login', 'core', 'global' )->authyAuthenticate( count( $availableMethods ) == 1 ? 'phone' : 'choose', FALSE, isset( $_SESSION['authyAuthError'] ) ? $_SESSION['authyAuthError'] : 'authy_error', FALSE, $availableMethods, NULL, $url );
|
||||
return \IPS\Theme::i()->getTemplate( 'login', 'core', 'global' )->authyAuthenticate( \count( $availableMethods ) == 1 ? 'phone' : 'choose', FALSE, isset( $_SESSION['authyAuthError'] ) ? $_SESSION['authyAuthError'] : 'authy_error', FALSE, $availableMethods, NULL, $url );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -522,7 +522,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
}
|
||||
catch ( Exception $e )
|
||||
{
|
||||
if ( in_array( $e->getCode(), array( Exception::TOKEN_REUSED, Exception::TOKEN_INVALID ) ) )
|
||||
if ( \in_array( $e->getCode(), array( Exception::TOKEN_REUSED, Exception::TOKEN_INVALID ) ) )
|
||||
{
|
||||
$_SESSION['authyAuthError'] = $e->getUserMessage();
|
||||
}
|
||||
@@ -680,11 +680,11 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
{
|
||||
$availableMethods = explode( ',', \IPS\Settings::i()->authy_method );
|
||||
|
||||
if ( in_array( 'authy', $availableMethods ) )
|
||||
if ( \in_array( 'authy', $availableMethods ) )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_authy_title');
|
||||
}
|
||||
elseif ( in_array( 'sms', $availableMethods ) and count( $availableMethods ) == 1 )
|
||||
elseif ( \in_array( 'sms', $availableMethods ) and \count( $availableMethods ) == 1 )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_sms_title');
|
||||
}
|
||||
@@ -703,9 +703,9 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
{
|
||||
$availableMethods = explode( ',', \IPS\Settings::i()->authy_method );
|
||||
|
||||
if ( in_array( 'authy', $availableMethods ) )
|
||||
if ( \in_array( 'authy', $availableMethods ) )
|
||||
{
|
||||
if ( count( $availableMethods ) == 1 )
|
||||
if ( \count( $availableMethods ) == 1 )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_authy_only_desc_user');
|
||||
}
|
||||
@@ -714,11 +714,11 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_authy_mixed_desc_user');
|
||||
}
|
||||
}
|
||||
elseif ( in_array( 'sms', $availableMethods ) and count( $availableMethods ) == 1 )
|
||||
elseif ( \in_array( 'sms', $availableMethods ) and \count( $availableMethods ) == 1 )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_sms_desc_user');
|
||||
}
|
||||
elseif ( in_array( 'phone', $availableMethods ) and count( $availableMethods ) == 1 )
|
||||
elseif ( \in_array( 'phone', $availableMethods ) and \count( $availableMethods ) == 1 )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_phone_desc_user');
|
||||
}
|
||||
@@ -737,11 +737,11 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
{
|
||||
$availableMethods = explode( ',', \IPS\Settings::i()->authy_method );
|
||||
|
||||
if ( in_array( 'authy', $availableMethods ) and count( $availableMethods ) == 1 )
|
||||
if ( \in_array( 'authy', $availableMethods ) and \count( $availableMethods ) == 1 )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_authy_recovery');
|
||||
}
|
||||
elseif ( in_array( 'sms', $availableMethods ) and count( $availableMethods ) == 1 )
|
||||
elseif ( \in_array( 'sms', $availableMethods ) and \count( $availableMethods ) == 1 )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('mfa_sms_recovery');
|
||||
}
|
||||
@@ -813,6 +813,7 @@ class _Handler extends \IPS\MFA\MFAHandler
|
||||
/**
|
||||
* Verify an Authy API Key
|
||||
*
|
||||
* @param string $val The API key submitted
|
||||
* @return array
|
||||
* @throws \DomainException
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user