<commit_before><?php defined('SYSPATH') or die('No direct script access.');

/**
 * Simple authentication API
 */
class SampleApp_Controller_Api_V1_Auth extends Controller_Api_Standard
{

	/**
	 * Confirm email of the account corresponding to the given token
	 */
	public function action_confirm_email ()
	{
		// Get the token
		$token = $this->request->post('token');

		// Build request data
		$data = array('token' => $token);

		// Get the account service
		$account_service = Service::factory('Account');

		// Get the api service
		$api_service = Service::factory('Api');

		try
		{
			// Confirm account
			$account = $account_service->confirm($data);

			// Return appropriate HTTP result
			$this->response($api_service->build_response_succeed(
				'Account has been confirmed'
			), 200);
		}
		catch (Exception $e)
		{
			Kohana_Exception::log($e, Log::ERROR);
			$this->response($api_service->build_response_failed('Bad request'), 400);
		}
	}

	public function action_forgot_password ()
	{
		// Get request parameters
		$email = $this->request->post('email');

		// Build request data
		$data = array('email' => $email);
<commit_msg>confirm email action now return the auth token<commit_after><?php defined('SYSPATH') or die('No direct script access.');

/**
 * Simple authentication API
 */
class SampleApp_Controller_Api_V1_Auth extends Controller_Api_Standard
{

	/**
	 * Confirm email of the account corresponding to the given token
	 */
	public function action_confirm_email ()
	{
		// Get the token
		$token = $this->request->post('token');

		// Build request data
		$data = array('token' => $token);

		// Get the account service
		$account_service = Service::factory('Account');

		// Get the api service
		$api_service = Service::factory('Api');

		try
		{
			// Confirm account
			$account = $account_service->confirm($data);

			// Get authentication token
			$token = $account_service->get_authentication_token($account);

			// Return appropriate HTTP result
			$this->response($api_service->build_response_succeed(
				'Account has been confirmed',
				array(
					'id' => $account->id(),
					'token' => $token->id()
				)
			), 200);
		}
		catch (Exception $e)
		{
			Kohana_Exception::log($e, Log::ERROR);
			$this->response($api_service->build_response_failed('Bad request'), 400);
		}
	}

	public function action_forgot_password ()
	{
		// Get request parameters
		$email = $this->request->post('email');

		// Build request data
		$data = array('email' => $email);

{'fraction_non_alphanumeric': 0.14605842336934774, 'fraction_numerical': 0.0056022408963585435, 'mean_word_length': 3.816955684007707, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '3521410', 'n_tokens_mistral': 865, 'n_tokens_neox': 745, 'n_words': 191}