<commit_before><?php


function lostpass_post(&$a) {

	$email = notags(trim($_POST['login-name']));
	if(! $email)
		goaway(z_root());

	$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) AND `verified` = 1 AND `blocked` = 0 LIMIT 1",
		dbesc($email),
		dbesc($email)
	);

	if(! count($r)) {
		notice( t('No valid account found.') . EOL);
		goaway(z_root());
	}

	$uid = $r[0]['uid'];
	$username = $r[0]['username'];

	$new_password = <PASSWORD>(12) . mt_<PASSWORD>(100,9999);
	$new_password_encoded = hash('<PASSWORD>',$new_password);

	$r = q("UPDATE `user` SET `pwdreset` = '%s' WHERE `uid` = %d LIMIT 1",
		dbesc($new_password_encoded),
		intval($uid)
	);
	if($r)
		info( t('Password reset request issued. Check your email.') . EOL);

	$email_tpl = get_intltext_template("lostpass_eml.tpl");
	$email_tpl = replace_macros($email_tpl, array(
			'$sitename' => $a->config['sitename'],<commit_msg>bug #339 - lostpass sending to username, not email<commit_after><?php


function lostpass_post(&$a) {

	$loginame = notags(trim($_POST['login-name']));
	if(! $loginame)
		goaway(z_root());

	$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) AND `verified` = 1 AND `blocked` = 0 LIMIT 1",
		dbesc($loginame),
		dbesc($loginame)
	);

	if(! count($r)) {
		notice( t('No valid account found.') . EOL);
		goaway(z_root());
	}

	$uid = $r[0]['uid'];
	$username = $r[0]['username'];
	$email = $r[0]['email'];

	$new_password = autoname(12) . mt_rand(100,9999);
	$new_password_encoded = hash('<PASSWORD>',$new_password);

	$r = q("UPDATE `user` SET `pwdreset` = '%s' WHERE `uid` = %d LIMIT 1",
		dbesc($new_password_encoded),
		intval($uid)
	);
	if($r)
		info( t('Password reset request issued. Check your email.') . EOL);

	$email_tpl = get_intltext_template("lostpass_eml.tpl");
	$email_tpl = replace_macros($email_tpl, array(
			'$sitename' => $a->config['sitename'],
{'fraction_non_alphanumeric': 0.21761929732564236, 'fraction_numerical': 0.01782905086523335, 'mean_word_length': 4.925465838509317, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6048170', 'n_tokens_mistral': 806, 'n_tokens_neox': 757, 'n_words': 160}