Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
+18
-12
@@ -11,9 +11,15 @@
|
||||
namespace IPS\Login;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DomainException;
|
||||
use IPS\Member;
|
||||
use Throwable;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -21,7 +27,7 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
* @brief Login Exception Class
|
||||
* @note If two login handlers produce different exceptions, the one with the higher code is shown. For example: if internal database returns "NO_ACCOUNT", but external returns "BAD_PASSWORD", the message the user needs to see is of course "Password incorrect" (rather than "Account does not exist").
|
||||
*/
|
||||
class _Exception extends \DomainException
|
||||
class Exception extends DomainException
|
||||
{
|
||||
/**
|
||||
* @brief No account found
|
||||
@@ -66,28 +72,28 @@ class _Exception extends \DomainException
|
||||
/**
|
||||
* @brief Member
|
||||
*/
|
||||
public $member = NULL;
|
||||
public ?Member $member = NULL;
|
||||
|
||||
/**
|
||||
* @brief Handler
|
||||
*/
|
||||
public $handler = NULL;
|
||||
public ?Handler $handler = NULL;
|
||||
|
||||
/**
|
||||
* @brief Details
|
||||
*/
|
||||
public $details = NULL;
|
||||
public ?string $details = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $message Message
|
||||
* @param int $code Code
|
||||
* @param \Exception|NULL $previous Previous Exception
|
||||
* @param \IPS\Member|null $member Member
|
||||
* @param int|null $code Code
|
||||
* @param Throwable|NULL $previous Previous Exception
|
||||
* @param Member|null $member Member
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $message, $code=NULL, $previous=NULL, $member=NULL )
|
||||
public function __construct( string $message, ?int $code=NULL, ?Throwable $previous=NULL, ?Member $member=NULL )
|
||||
{
|
||||
parent::__construct( $message, $code, $previous );
|
||||
$this->member = $member;
|
||||
@@ -97,10 +103,10 @@ class _Exception extends \DomainException
|
||||
* Allow the code to be adjusted
|
||||
*
|
||||
* @note This is used when a MERGE_SOCIAL_ACCOUNT is thrown and we need to change it to a LOCAL_ACCOUNT_ALREADY_MERGED exception
|
||||
* @param int $code New code
|
||||
* @param int $code New code
|
||||
* @return void
|
||||
*/
|
||||
public function setCode( $code )
|
||||
public function setCode( int $code ) : void
|
||||
{
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user