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

+51 -22
View File
@@ -11,7 +11,7 @@
namespace IPS\Login\Handler;
/* 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;
@@ -38,13 +38,35 @@ class _Standard extends \IPS\Login\Handler
* Authenticate
*
* @param \IPS\Login $login The login object
* @param string $usernameOrEmail The username or email address provided by the user
* @param string $password The plaintext password provided by the user
* @param string $usernameOrEmail The username or email address provided by the user
* @param object $password The plaintext password provided by the user, wrapped in an object that can be cast to a string so it doesn't show in any logs
* @return \IPS\Member
* @throws \IPS\Login\Exception
*/
public function authenticateUsernamePassword( \IPS\Login $login, $usernameOrEmail, $password )
{
$type = 'username_or_email';
switch ( $this->authType() )
{
case \IPS\Login::AUTH_TYPE_USERNAME + \IPS\Login::AUTH_TYPE_EMAIL:
$type = 'username_or_email';
break;
case \IPS\Login::AUTH_TYPE_USERNAME:
$type = 'username';
break;
case \IPS\Login::AUTH_TYPE_EMAIL:
$type = 'email_address';
break;
}
/* Make sure we have the username or email */
if( !$usernameOrEmail )
{
throw new \IPS\Login\Exception( \IPS\Member::loggedIn()->language()->addToStack('login_err_no_account', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $type ) ) ) ), \IPS\Login\Exception::NO_ACCOUNT );
}
/* Get member(s) */
$where = array();
$params = array();
@@ -73,23 +95,8 @@ class _Standard extends \IPS\Login\Handler
$members = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array_merge( array( implode( ' OR ', $where ) ), $params ) ), 'IPS\Member' );
/* If we didn't match any, throw an exception */
if ( !count( $members ) )
if ( !\count( $members ) )
{
$type = 'username_or_email';
switch ( $this->authType() )
{
case \IPS\Login::AUTH_TYPE_USERNAME + \IPS\Login::AUTH_TYPE_EMAIL:
$type = 'username_or_email';
break;
case \IPS\Login::AUTH_TYPE_USERNAME:
$type = 'username';
break;
case \IPS\Login::AUTH_TYPE_EMAIL:
$type = 'email_address';
break;
}
throw new \IPS\Login\Exception( \IPS\Member::loggedIn()->language()->addToStack('login_err_no_account', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $type ) ) ) ), \IPS\Login\Exception::NO_ACCOUNT );
}
@@ -117,8 +124,8 @@ class _Standard extends \IPS\Login\Handler
/**
* Authenticate
*
* @param \IPS\Member $member The member
* @param string $password The plaintext password provided by the user
* @param \IPS\Member $member The member
* @param object $password The plaintext password provided by the user, wrapped in an object that can be cast to a string so it doesn't show in any logs
* @return bool
*/
public function authenticatePasswordForMember( \IPS\Member $member, $password )
@@ -155,11 +162,21 @@ class _Standard extends \IPS\Login\Handler
return $this->canProcess( $member );
}
/**
* Can this handler sync passwords?
*
* @return bool
*/
public function canSyncPassword()
{
return TRUE;
}
/**
* Change Password
*
* @param \IPS\Member $member The member
* @param string $newPassword New Password
* @param object $newPassword New Password wrapped in an object that can be cast to a string so it doesn't show in any logs
* @return void
*/
public function changePassword( \IPS\Member $member, $newPassword )
@@ -168,6 +185,18 @@ class _Standard extends \IPS\Login\Handler
$member->save();
}
/**
* Force Password Reset URL
*
* @param \IPS\Member $member The member
* @param \IPS\Http\Url|NULL $ref Referrer
* @return \IPS\Http\Url|NULL
*/
public function forcePasswordResetUrl( \IPS\Member $member, ?\IPS\Http\Url $ref = NULL ): ?\IPS\Http\Url
{
return $member->passwordResetForced( $ref );
}
/**
* Show in Account Settings?
*