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

class Jelly_Field_Password extends Field_String
{
	/**
	 * @var callback A valid callback to use for hashing the password
	 */
	public $hash_with = 'sha1';
	
	/**
	 * Hashes the password on set
	 *
	 * @param string $value 
	 * @return void
	 * @author <NAME>
	 */
	public function set($value)
	{
		return call_user_func($this->hash_with, $value);
	}
}<commit_msg>Fixing password hashing<commit_after><?php defined('SYSPATH') or die('No direct script access.');

class Jelly_Field_Password extends Field_String
{
	/**
	 * @var callback A valid callback to use for hashing the password or FALSE to not hash
	 */
	public $hash_with = 'sha1';
	
	/**
	 * Hashes the password on save only if it's changed
	 *
	 * @param string $model 
	 * @param string $value 
	 * @return void
	 * @author <NAME>
	 */
	public function save($model, $value)
	{
		if ($this->hash_with)
		{
			// Verify value has changed
			if ($model->get($this->name, FALSE) != $model->get($this->name))
			{
				$value = call_user_func($this->hash_with, $value);
			}
		}
		
		return $value;
	}
}
{'fraction_non_alphanumeric': 0.13920704845814977, 'fraction_numerical': 0.001762114537444934, 'mean_word_length': 3.4901185770750986, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, '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': '341484', 'n_tokens_mistral': 406, 'n_tokens_neox': 365, 'n_words': 113}