Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+27 -14
View File
@@ -12,7 +12,7 @@
namespace IPS\Login;
/* 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;
@@ -55,12 +55,13 @@ class _Success
* @param \IPS\Login\Handler $handler The handler that processed the login
* @param bool $rememberMe If the "remember me" box was checked
* @param bool $anonymous If the "sign in anonymously" box was checked
* @param bool $sendNewDeviceEmail Should a new device email be sent.
* @return void
*/
public function __construct( \IPS\Member $member, \IPS\Login\Handler $handler, $rememberMe = TRUE, $anonymous = FALSE )
public function __construct( \IPS\Member $member, \IPS\Login\Handler $handler, $rememberMe = TRUE, $anonymous = FALSE, $sendNewDeviceEmail = TRUE )
{
$this->member = $member;
$this->device = \IPS\Member\Device::loadOrCreate( $member );
$this->device = \IPS\Member\Device::loadOrCreate( $member, $sendNewDeviceEmail );
$this->handler = $handler;
$this->rememberMe = $rememberMe;
$this->anonymous = ( $anonymous or $member->group['g_hide_online_list'] );
@@ -74,10 +75,13 @@ class _Success
*/
public function mfa( $area = NULL )
{
\IPS\MFA\MFAHandler::resetAuthentication();
if ( !$area )
{
$area = $this->device->known ? 'AuthenticateFrontKnown' : 'AuthenticateFront';
}
return \IPS\MFA\MFAHandler::accessToArea( 'core', $area, \IPS\Http\Url::internal( '' ), $this->member );
}
@@ -88,23 +92,32 @@ class _Success
*/
public function process()
{
/* Log in */
\IPS\Session::i()->setMember( $this->member );
if ( $this->anonymous and !\IPS\Settings::i()->disable_anonymous )
/* First, if we are already logged in as someone, log out */
if ( \IPS\Member::loggedIn()->member_id )
{
\IPS\Session::i()->setAnon();
}
else
{
/* If we're not anonymous, update our last visit time */
$this->member->last_visit = $this->member->last_activity;
$this->member->save();
\IPS\Login::logout();
}
/* Log in */
\IPS\Session::i()->setMember( $this->member );
if ( $this->anonymous )
{
if ( !\IPS\Settings::i()->disable_anonymous )
{
\IPS\Session::i()->setAnon();
}
}
$this->member->last_visit = $this->member->last_activity;
$this->member->save();
/* Log device */
$this->device->anonymous = $this->anonymous and !\IPS\Settings::i()->disable_anonymous;
$this->device->updateAfterAuthentication( $this->rememberMe, $this->handler );
/* Remove any noCache cookies */
\IPS\Request::i()->setCookie( 'noCache', 0, \IPS\DateTime::ts( time() - 86400 ) );
/* Member sync */
$this->member->memberSync( 'onLogin' );
$this->member->profileSync();