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,27 +11,57 @@
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login Exception Class
|
||||
* @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
|
||||
{
|
||||
// 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")
|
||||
/**
|
||||
* @brief No account found
|
||||
*/
|
||||
const NO_ACCOUNT = 1;
|
||||
|
||||
/**
|
||||
* @brief An internal error occurred
|
||||
*/
|
||||
const INTERNAL_ERROR = 2;
|
||||
|
||||
/**
|
||||
* @brief Spam service denied new account creation
|
||||
*/
|
||||
const REGISTRATION_DENIED_BY_SPAM_SERVICE = 3;
|
||||
|
||||
/**
|
||||
* @brief Registrations are disabled
|
||||
*/
|
||||
const REGISTRATION_DISABLED = 4;
|
||||
|
||||
/**
|
||||
* @brief The password was not correct
|
||||
*/
|
||||
const BAD_PASSWORD = 5;
|
||||
|
||||
/**
|
||||
* @brief The account should be merged with a local account
|
||||
*/
|
||||
const MERGE_SOCIAL_ACCOUNT = 6;
|
||||
|
||||
/**
|
||||
* @brief The account is locked
|
||||
*/
|
||||
const ACCOUNT_LOCKED = 7;
|
||||
|
||||
/**
|
||||
* @brief The local account is already merged with a different account from this handler
|
||||
*/
|
||||
const LOCAL_ACCOUNT_ALREADY_MERGED = 8;
|
||||
|
||||
/**
|
||||
* @brief Member
|
||||
@@ -39,7 +69,7 @@ class _Exception extends \DomainException
|
||||
public $member = NULL;
|
||||
|
||||
/**
|
||||
* @bried Handler
|
||||
* @brief Handler
|
||||
*/
|
||||
public $handler = NULL;
|
||||
|
||||
@@ -62,4 +92,16 @@ class _Exception extends \DomainException
|
||||
parent::__construct( $message, $code, $previous );
|
||||
$this->member = $member;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return void
|
||||
*/
|
||||
public function setCode( $code )
|
||||
{
|
||||
$this->code = $code;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user