<commit_before><?php
namespace content_enter\username\set;


class model
{

	public function post()
	{
		$username = \dash\request::post('username');
		$username = trim($username);
		if($username)
		{
			if(mb_strlen($username) < 5)
			{
				\dash\notif::error(T_("You must set large than 5 character in username"));
				return false;
			}

			if(mb_strlen($username) > 50)
			{
				\dash\notif::error(T_("You must set less than 50 character in username"));
				return false;
			}

			// check username exist
			$check_exist_name = \dash\db\users::get_by_username($username);

			if(!empty($check_exist_name))
			{
				\dash\log::set('usernameTaken', ['data' => $username]);
				\dash\notif::error(T_("This username alreay taked!"));
				return false;
			}

			\dash\log::set('usernameSet', ['data' => $username]);


			\dash\db\users::update(['username' => $username], \dash\user::id());
			// set the alert message
			\dash\utility\enter::set_session('alert' , ['text' => T_("Your username was set")]);
			// open lock of alert page
			\dash\utility\enter::next_step('alert');
			// go to alert page
			\dash\utility\enter::go_to('alert');

		}
		else
		{
			\dash\utility\enter::try('username_username_not_set');
			\dash\notif::error(T_("Please enter the username"));
			return false;
		}
	}<commit_msg>comment set username in enter<commit_after><?php
namespace content_enter\username\set;


class model
{

	public function post()
	{
		$username = \dash\request::post('username');
		$username = trim($username);
		if($username)
		{
			if(mb_strlen($username) < 5)
			{
				\dash\notif::error(T_("You must set large than 5 character in username"));
				return false;
			}

			if(mb_strlen($username) > 50)
			{
				\dash\notif::error(T_("You must set less than 50 character in username"));
				return false;
			}

			// check username exist
			$check_exist_name = \dash\db\users::get_by_username($username);

			if(!empty($check_exist_name))
			{
				\dash\log::set('usernameTaken', ['data' => $username]);
				\dash\notif::error(T_("This username alreay taked!"));
				return false;
			}

			\dash\log::set('usernameSet', ['data' => $username]);


			// \dash\db\users::update(['username' => $username], \dash\user::id());
			// set the alert message
			\dash\utility\enter::set_session('alert' , ['text' => T_("Your username was set")]);
			// open lock of alert page
			\dash\utility\enter::next_step('alert');
			// go to alert page
			\dash\utility\enter::go_to('alert');

		}
		else
		{
			\dash\utility\enter::try('username_username_not_set');
			\dash\notif::error(T_("Please enter the username"));
			return false;
		}
	}
{'fraction_non_alphanumeric': 0.1800227876946449, 'fraction_numerical': 0.004557538928978352, 'mean_word_length': 3.604895104895105, 'pattern_counts': {'":': 0, '<': 7, '<?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': '516830', 'n_tokens_mistral': 1062, 'n_tokens_neox': 892, 'n_words': 182}