Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -5,13 +5,14 @@
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage convert
|
||||
* @since 15 October 2017
|
||||
*/
|
||||
|
||||
namespace IPS\convert;
|
||||
|
||||
/* 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 +39,35 @@ class _Login 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 +96,8 @@ class _Login 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 );
|
||||
}
|
||||
|
||||
@@ -126,7 +134,7 @@ class _Login extends \IPS\Login\Handler
|
||||
* Authenticate
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param string $password The plaintext password 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 bool
|
||||
*/
|
||||
public function authenticatePasswordForMember( \IPS\Member $member, $password )
|
||||
@@ -164,12 +172,12 @@ class _Login extends \IPS\Login\Handler
|
||||
/* New login method */
|
||||
if( class_exists( $application ) AND method_exists( $application, 'login' ) )
|
||||
{
|
||||
$success = $application::login( $member, $password );
|
||||
$success = $application::login( $member, (string) $password );
|
||||
}
|
||||
/* Deprecated method */
|
||||
else
|
||||
{
|
||||
$success = $this->$sw( $member, $password );
|
||||
$success = $this->$sw( $member, (string) $password );
|
||||
}
|
||||
|
||||
unset( $member->misc );
|
||||
@@ -194,6 +202,7 @@ class _Login extends \IPS\Login\Handler
|
||||
/**
|
||||
* Can this handler process a login for a member?
|
||||
*
|
||||
* @param \IPS\Member $member Member
|
||||
* @return bool
|
||||
*/
|
||||
public function canProcess( \IPS\Member $member )
|
||||
@@ -204,6 +213,7 @@ class _Login extends \IPS\Login\Handler
|
||||
/**
|
||||
* Can this handler process a password change for a member?
|
||||
*
|
||||
* @param \IPS\Member $member Member
|
||||
* @return bool
|
||||
*/
|
||||
public function canChangePassword( \IPS\Member $member )
|
||||
@@ -215,7 +225,7 @@ class _Login extends \IPS\Login\Handler
|
||||
* 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 )
|
||||
|
||||
Reference in new issue
Block a user