Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -28,40 +28,49 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
{
|
||||
/* Init login class */
|
||||
$url = \IPS\Http\Url::internal( "app=core&module=system&controller=login", 'admin', NULL, array(), \IPS\Settings::i()->logins_over_https );
|
||||
$url = \IPS\Http\Url::internal( "app=core&module=system&controller=login", 'admin' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'ref', \IPS\Request::i()->ref );
|
||||
}
|
||||
$login = new \IPS\Login( $url );
|
||||
$login->flagOptions = FALSE;
|
||||
$login = new \IPS\Login( $url, \IPS\Login::LOGIN_ACP );
|
||||
|
||||
/* Set the default tab */
|
||||
$forms = $login->forms( TRUE, ( \IPS\Request::i()->ref ?: TRUE ) );
|
||||
|
||||
$this->activeTab = \IPS\Request::i()->tab ?: key($forms);
|
||||
|
||||
/* Process */
|
||||
/* Authenticate */
|
||||
$error = NULL;
|
||||
try
|
||||
{
|
||||
/* Authenticate */
|
||||
$member = $login->authenticate();
|
||||
if ( $member !== NULL and $member->member_id )
|
||||
/* If we were successful... */
|
||||
if ( $success = $login->authenticate() )
|
||||
{
|
||||
/* Success */
|
||||
if ( $member->isAdmin() )
|
||||
/* Check we can actually access the ACP */
|
||||
if ( $success->member->isAdmin() )
|
||||
{
|
||||
$this->_doLogin( $member );
|
||||
/* If we need to do two-factor authentication, do that */
|
||||
if ( $success->mfa( 'AuthenticateAdmin' ) )
|
||||
{
|
||||
$_SESSION['processing2FA'] = array( 'memberId' => $success->member->member_id );
|
||||
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'admin', 'login' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'ref', \IPS\Request::i()->ref );
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->auth ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'auth', \IPS\Request::i()->auth );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
}
|
||||
|
||||
/* Otherwise go ahead */
|
||||
$this->_doLogin( $success->member );
|
||||
}
|
||||
/* Error */
|
||||
/* ... otherwise show an error */
|
||||
else
|
||||
{
|
||||
$error = 'no_access_cp';
|
||||
|
||||
/* Log */
|
||||
$this->log( 'fail' );
|
||||
}
|
||||
}
|
||||
@@ -69,11 +78,10 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
catch ( \IPS\Login\Exception $e )
|
||||
{
|
||||
$error = $e->getMessage();
|
||||
|
||||
/* Log */
|
||||
$this->log( 'fail' );
|
||||
}
|
||||
|
||||
/* Have we been sent here because of an IP address mismatch? */
|
||||
if ( is_null( $error ) AND isset( \IPS\Request::i()->error ) )
|
||||
{
|
||||
switch( \IPS\Request::i()->error )
|
||||
@@ -87,16 +95,8 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get icons */
|
||||
$icons = array();
|
||||
$haveStandard = FALSE;
|
||||
foreach ( \IPS\Login::handlers() as $key => $handler )
|
||||
{
|
||||
$icons[ $key ] = $handler::$icon;
|
||||
}
|
||||
|
||||
/* Do we need an error? */
|
||||
/* Do we need to show a message about an unfinished upgrade? */
|
||||
$upgradeError = FALSE;
|
||||
if ( !\IPS\IN_DEV and !isset( \IPS\Request::i()->noWarning ) )
|
||||
{
|
||||
@@ -109,7 +109,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
/* Display Login Form */
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_system.js', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'system/login.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'system' )->login( $forms, $this->activeTab, $error, $icons, $upgradeError ) );
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'system' )->login( $login, $error, $upgradeError ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,6 +203,9 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the cookie */
|
||||
\IPS\Request::i()->setCookie( 'acp_login_key', \IPS\Session::i()->cookieKey );
|
||||
|
||||
/* Boink - if we're in recovery mode, go there */
|
||||
if ( \IPS\RECOVERY_MODE === TRUE )
|
||||
{
|
||||
@@ -252,4 +255,5 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Db::i()->insert( 'core_admin_login_logs', $save );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user