<commit_before><?php

namespace IPS\Login;

/* To prevent PHP errors (extending class does not exist) revealing path */
if (!defined('\IPS\SUITE_UNIQUE_KEY')) {
	header((isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0') . ' 403 Forbidden');
	exit;
}

/**
 * Steam Login Handler
 */
class _Steam extends \IPS\Login\LoginAbstract
{
	/**
	 * @brief    Login handler key
	 */
	public static $loginKey = 'Steam';

	/**
	 * @brief    Icon
	 */
	public static $icon = 'steam';

	/**
	 * Get Form
	 *
	 * @param    string $url The URL for the login page
	 * @param    bool   $ucp Is UCP? (as opposed to login form)
	 *
	 * @return    string
	 */
	public function loginForm($url, $ucp = false)
	{
		return \IPS\Theme::i()->getTemplate('plugins', 'core',
			'global')->steam((string)\IPS\Http\Url::external('https://steamcommunity.com/openid/login')->setQueryString(array(
			'openid.ns' => 'http://specs.openid.net/auth/2.0',
			'openid.mode' => 'checkid_setup',
			'openid.return_to' => (string)\IPS\Http\Url::internal('applications/core/interface/steam/auth.php', 'none'),
			'openid.realm' => (string)\IPS\Http\Url::internal('', 'none'),
			'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select',
			'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select',
			'openid.assoc_handle' => ($ucp ? 'ucp' : \IPS\Dispatcher::i()->controllerLocation)
		)));
	}

	/**
	 * Authenticate
	 *<commit_msg>Fixed fatal error call to canProcess when disassociating a login handler<commit_after><?php

namespace IPS\Login;

/* To prevent PHP errors (extending class does not exist) revealing path */
if (!defined('\IPS\SUITE_UNIQUE_KEY')) {
	header((isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0') . ' 403 Forbidden');
	exit;
}

/**
 * Steam Login Handler
 */
class _Steam extends \IPS\Login\LoginAbstract
{
	/**
	 * @brief    Login handler key
	 */
	public static $loginKey = 'Steam';

	/**
	 * @brief    Icon
	 */
	public static $icon = 'steam';

	/**
	 * Get Form
	 *
	 * @param    string $url The URL for the login page
	 * @param    bool   $ucp Is UCP? (as opposed to login form)
	 *
	 * @return    string
	 */
	public function loginForm($url, $ucp = false)
	{
		return \IPS\Theme::i()->getTemplate('plugins', 'core',
			'global')->steam((string)\IPS\Http\Url::external('https://steamcommunity.com/openid/login')->setQueryString(array(
			'openid.ns' => 'http://specs.openid.net/auth/2.0',
			'openid.mode' => 'checkid_setup',
			'openid.return_to' => (string)\IPS\Http\Url::internal('applications/core/interface/steam/auth.php', 'none'),
			'openid.realm' => (string)\IPS\Http\Url::internal('', 'none'),
			'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select',
			'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select',
			'openid.assoc_handle' => ($ucp ? 'ucp' : \IPS\Dispatcher::i()->controllerLocation)
		)));
	}

	/**
	 * Can a member sign in with this login handler?
	 * Used to ensure when a user disassociates a social login that they have some other way of logging in
	 *
	 * @param	\IPS\Member	$member	The member
	 * @return	bool
	 */
	public function canProcess(\IPS\Member $member)
	{
		// Return a truthy or falsy value
		return (bool) $member->steamid;
	}

	/**
	 * Authenticate
	 *
{'fraction_non_alphanumeric': 0.18173598553345388, 'fraction_numerical': 0.006630500301386378, 'mean_word_length': 3.6944837340876946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6934372', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1141, 'n_words': 246}