<commit_before><?php
class users_ChromeLoginAction extends users_Action
{
	/**
	 * @param Context $context
	 * @param Request $request
	 */
	public function _execute($context, $request)
	{
		$login = trim($request->getParameter('login'));
		$password = trim($request->getParameter('password'));
		$adminemail = trim($request->getParameter('adminemail'));
		$result = array();
		if (empty($login) || empty($password))
		{		
			$result['error'] = f_Locale::translate('&modules.users.errors.Invalid-login-or-password;');
		}
		else
		{			
			$us = $this->getUserService();
			$user = $us->getBackEndUserByLogin($login);
			
			if ($user !== null && $user->getEmail() == null && $user->getPasswordmd5() == null)
			{
				try 
				{
					$this->getTransactionManager()->beginTransaction();
					$user->setEmail($adminemail);
					$user->setPassword($password);
					$user->save();
					$this->getTransactionManager()->commit();
				}
				catch (Exception $e)
				{
					$this->getTransactionManager()->rollBack($e);
					if ($e instanceof TransactionCancelledException) 
					{
						$e = $e->getSourceException();
					}
					
					if ($e instanceof ValidationException)
					{
						$pos = strpos($e->getMessage(), ':');
						if ($pos)
						{
							$result['error'] = substr($e->getMessage(), $pos + 1);
						}
						else
						{
							$result['error'] = $e->getMessage();
						}
					}
					else
					{
						$result['error'] = $e->getMessage();
					}
					echo JsonService::getInstance()->encode($result);
					return View::NONE;
				}
			}
			
			$user = $us->getIdentifiedBackendUser($login, $password);
			if ($user !== null)
			{
				$us->authenticateBackEndUser($user);
				$result['ok'] = defined("PROJECT_ID") ? PROJECT_ID : PROFILE;
				$_SESSION['ChromeBaseUri'] = "rbschange/content/ext/" . $result['ok'];	<commit_msg>[NEW] Ajout du parametrage de la langue du BO depuis l'extension<commit_after><?php
class users_ChromeLoginAction extends users_Action
{
	/**
	 * @param Context $context
	 * @param Request $request
	 */
	public function _execute($context, $request)
	{
		$login = trim($request->getParameter('login'));
		$password = trim($request->getParameter('password'));
		$adminemail = trim($request->getParameter('adminemail'));
		$result = array();
		if (empty($login) || empty($password))
		{		
			$result['error'] = f_Locale::translate('&modules.users.errors.Invalid-login-or-password;');
		}
		else
		{			
			$us = $this->getUserService();
			$user = $us->getBackEndUserByLogin($login);
			
			if ($user !== null && $user->getEmail() == null && $user->getPasswordmd5() == null)
			{
				try 
				{
					$this->getTransactionManager()->beginTransaction();
					$user->setEmail($adminemail);
					$user->setPassword($password);
					$user->save();
					$this->getTransactionManager()->commit();
				}
				catch (Exception $e)
				{
					$this->getTransactionManager()->rollBack($e);
					if ($e instanceof TransactionCancelledException) 
					{
						$e = $e->getSourceException();
					}
					
					if ($e instanceof ValidationException)
					{
						$pos = strpos($e->getMessage(), ':');
						if ($pos)
						{
							$result['error'] = substr($e->getMessage(), $pos + 1);
						}
						else
						{
							$result['error'] = $e->getMessage();
						}
					}
					else
					{
						$result['error'] = $e->getMessage();
					}
					echo JsonService::getInstance()->encode($result);
					return View::NONE;
				}
			}
			
			$user = $us->getIdentifiedBackendUser($login, $password);
			if ($user !== null)
			{
				$us->authenticateBackEndUser($user);
				if ($request->hasParameter('uilang'))
				{
					$uilang = $request->getParameter('uilang');
					if (in_array($uilang, RequestContext::getInstance()->getUISupportedLanguages()))
					{
						$_SESSION['uilang']	= $uilang;
					}
				}
				
				$result['ok'] = defined("PROJECT_ID") ? PROJECT_ID : PROFILE;
				$_SESSION['ChromeBaseUri'] = "rbschange/content/ext/" . $result['ok'];	
{'fraction_non_alphanumeric': 0.18869828456104945, 'fraction_numerical': 0.0010090817356205853, 'mean_word_length': 3.1216216216216215, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 54, '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': '505091', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1249, 'n_words': 203}