summaryrefslogtreecommitdiffstats
path: root/settings/ajax
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-06-04 18:42:25 +0000
committerTom Needham <needham.thomas@gmail.com>2012-06-04 18:44:55 +0000
commitdaa4d2cd84faa515a2f84c5638ed8bfe28ce4c79 (patch)
tree3d7b25fe59141445432a24ffb9ea3ee1bd1874c6 /settings/ajax
parentb117a1e3ec4bee5365db2a2363b21013e9b027e0 (diff)
downloadnextcloud-server-daa4d2cd84faa515a2f84c5638ed8bfe28ce4c79.tar.gz
nextcloud-server-daa4d2cd84faa515a2f84c5638ed8bfe28ce4c79.zip
Validate email on save
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/lostpassword.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/settings/ajax/lostpassword.php b/settings/ajax/lostpassword.php
index 5874dec9647..9c31c9ce8da 100644
--- a/settings/ajax/lostpassword.php
+++ b/settings/ajax/lostpassword.php
@@ -8,12 +8,11 @@ OC_JSON::checkLoggedIn();
$l=OC_L10N::get('core');
// Get data
-if( isset( $_POST['email'] ) ){
- $email=trim($_POST['email']);
+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 Changed") )));
+ OC_JSON::success(array("data" => array( "message" => $l->t("Email saved") )));
}else{
- OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
+ OC_JSON::error(array("data" => array( "message" => $l->t("Invalid email") )));
}
-?>
+?> \ No newline at end of file