<commit_before><?php

// Init owncloud
require_once('../../lib/base.php');

OC_JSON::checkLoggedIn();

$l=OC_L10N::get('core');

// Get data
if( isset( $_POST['email'] ) ){
	$email=trim($_POST['email']);
	OC_Preferences::setValue(OC_User::getUser(),'settings','email',$email);
	OC_JSON::success(array("data" => array( "message" => $l->t("email Changed") )));
}else{
	OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
}

?>
<commit_msg>Validate email on save<commit_after><?php

// Init owncloud
require_once('../../lib/base.php');

OC_JSON::checkLoggedIn();

$l=OC_L10N::get('core');

// Get data
if( isset( $_POST['email'] ) && filter_var( $_POST['email'], FILTER_VALIDATE_EMAIL) ){
	$email=trim($_POST['email']);
	OC_Preferences::setValue(OC_User::getUser(),'settings','email',$email);
	OC_JSON::success(array("data" => array( "message" => $l->t("Email saved") )));
}else{
	OC_JSON::error(array("data" => array( "message" => $l->t("Invalid email") )));
}

?>
{'fraction_non_alphanumeric': 0.26437941473259335, 'fraction_numerical': 0.004036326942482341, 'mean_word_length': 6.936, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6250338', 'n_tokens_mistral': 370, 'n_tokens_neox': 373, 'n_words': 54}