Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
+16
-9
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Windows Live Login Handler
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 18 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -31,18 +31,19 @@ class _Live extends LoginAbstract
|
||||
/**
|
||||
* Get Form
|
||||
*
|
||||
* @param string $url The URL for the login page
|
||||
* @param bool $ucp Is UCP? (as opposed to login form)
|
||||
* @param \IPS\Http\Url $url The URL for the login page
|
||||
* @param bool $ucp Is UCP? (as opposed to login form)
|
||||
* @param \IPS\Http\Url $destination The URL to redirect to after a successful login
|
||||
* @return string
|
||||
*/
|
||||
public function loginForm( $url, $ucp=FALSE )
|
||||
{
|
||||
public function loginForm( \IPS\Http\Url $url, $ucp = FALSE, \IPS\Http\Url $destination = NULL )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'login', 'core', 'global' )->live( (string) \IPS\Http\Url::external( 'https://login.live.com/oauth20_authorize.srf' )->setQueryString( array(
|
||||
'client_id' => $this->settings['client_id'],
|
||||
'scope' => 'wl.signin wl.emails wl.offline_access',
|
||||
'response_type' => 'code',
|
||||
'redirect_uri' => (string) \IPS\Http\Url::internal( 'applications/core/interface/microsoft/auth.php', 'none' ),
|
||||
'state' => ( $ucp ? 'ucp' : \IPS\Dispatcher::i()->controllerLocation )
|
||||
'redirect_uri' => (string) \IPS\Http\Url::internal( 'applications/core/interface/microsoft/auth.php', 'none', NULL, array(), \IPS\Settings::i()->logins_over_https ? \IPS\Http\Url::PROTOCOL_HTTPS : 0 ),
|
||||
'state' => ( $ucp ? 'ucp' : \IPS\Dispatcher::i()->controllerLocation ) . '-' . \IPS\Session::i()->csrfKey . '-' . ( $destination ? base64_encode( $destination ) : '' )
|
||||
) ) );
|
||||
}
|
||||
|
||||
@@ -58,10 +59,16 @@ class _Live extends LoginAbstract
|
||||
{
|
||||
try
|
||||
{
|
||||
/* CSRF Check */
|
||||
if ( \IPS\Request::i()->state !== \IPS\Session::i()->csrfKey )
|
||||
{
|
||||
throw new \IPS\Login\Exception( 'CSRF_FAIL', \IPS\Login\Exception::INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
/* Send HTTP request */
|
||||
$response = \IPS\Http\Url::external( 'https://login.live.com/oauth20_token.srf' )->request()->post( array(
|
||||
'client_id' => $this->settings['client_id'],
|
||||
'redirect_uri' => (string) \IPS\Http\Url::internal( 'applications/core/interface/microsoft/auth.php', 'none' ),
|
||||
'redirect_uri' => (string) \IPS\Http\Url::internal( 'applications/core/interface/microsoft/auth.php', 'none', NULL, array(), \IPS\Settings::i()->logins_over_https ? \IPS\Http\Url::PROTOCOL_HTTPS : 0 ),
|
||||
'client_secret' => $this->settings['client_secret'],
|
||||
'code' => \IPS\Request::i()->code,
|
||||
'grant_type' => 'authorization_code'
|
||||
|
||||
Reference in new issue
Block a user