<commit_before><?php

use Biome\Core\Controller;
use Biome\Core\Collection;

class BaseController extends Controller
{
	public function beforeRoute()
	{
		/**
		 * Check route rights.
		 */
		$this->checkAuthorizations();

		/**
		 * Check authentication.
		 */
		$auth = Collection::get('auth');
		if(!$auth->isAuthenticated())
		{
			$this->response()->redirect('');
			return FALSE;
		}

		return TRUE;
	}
}<commit_msg>Add a flash message on forbidden.<commit_after><?php

use Biome\Core\Controller;
use Biome\Core\Collection;

class BaseController extends Controller
{
	public function beforeRoute()
	{
		/**
		 * Check route rights.
		 */
		$this->checkAuthorizations();

		/**
		 * Check authentication.
		 */
		$auth = Collection::get('auth');
		if(!$auth->isAuthenticated())
		{
			$this->flash()->error('Forbidden!');
			$this->response()->redirect('');
			return FALSE;
		}

		return TRUE;
	}
}
{'fraction_non_alphanumeric': 0.17035398230088494, 'fraction_numerical': 0.0, 'mean_word_length': 3.5477386934673367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4214031', 'n_tokens_mistral': 328, 'n_tokens_neox': 282, 'n_words': 58}