<commit_before><?php
App::uses('AppController', 'Controller');

/**
 * "Me" controller
 *
 * Handles requests about myself.
 */
class MeController extends AppController
{
	/**
	 * Controller name
	 *
	 * @var string
	 */
	public $name = 'Me';

	/**
	 * The models this controller uses
	 *
	 * @var array
	 */
	public $uses = array(
		'Person',
		'ProductListingBuyers',
		'ProductSuggestion'
	);
	
	public function login()
	{
		$userId = FB::getUser();
		if (empty($userId))
		{
			throw new ForbiddenException();
		}

		//Exchange the short-term access token for a long-lived access token.
		FB::setExtendedAccessToken();
		$this->Person->id = $userId;
		if (strpos(FB::getAccessToken(), '|') !== false)
		{
			//We have our secret key inside. Don't store in database.
			$this->Person->save(array(
				'oauth_token' => null
			));
		}
		else
		{
			$this->Person->save(array(
				'oauth_token' => FB::getAccessToken()
			));
		}

		$this->Auth->login(array('id' => $userId));
		
		$referer = $this->request->referer();
		if (empty($referer))
		{
			$this->set('_serialize', array());
		}
		else
		{
			$this->redirect($this->request->referer(), 303);
		}
	}

	/**
	 * Gets a list of items which I want to buy.
	 */
	public function wants()<commit_msg>No need to redirect after logging in, because now our logins are currently all AJAX responses.<commit_after><?php
App::uses('AppController', 'Controller');

/**
 * "Me" controller
 *
 * Handles requests about myself.
 */
class MeController extends AppController
{
	/**
	 * Controller name
	 *
	 * @var string
	 */
	public $name = 'Me';

	/**
	 * The models this controller uses
	 *
	 * @var array
	 */
	public $uses = array(
		'Person',
		'ProductListingBuyers',
		'ProductSuggestion'
	);
	
	public function login()
	{
		$userId = FB::getUser();
		if (empty($userId))
		{
			throw new ForbiddenException();
		}

		//Exchange the short-term access token for a long-lived access token.
		FB::setExtendedAccessToken();
		$this->Person->id = $userId;
		if (strpos(FB::getAccessToken(), '|') !== false)
		{
			//We have our secret key inside. Don't store in database.
			$this->Person->save(array(
				'oauth_token' => null
			));
		}
		else
		{
			$this->Person->save(array(
				'oauth_token' => FB::getAccessToken()
			));
		}

		$this->Auth->login(array('id' => $userId));
		$this->set('_serialize', array());
	}

	/**
	 * Gets a list of items which I want to buy.
	 */
	public function wants()
{'fraction_non_alphanumeric': 0.1721881390593047, 'fraction_numerical': 0.001226993865030675, 'mean_word_length': 3.224525043177893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, 'https://': 0, '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': '658809', 'n_tokens_mistral': 940, 'n_tokens_neox': 818, 'n_words': 207}