diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-06-04 18:42:25 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-06-04 18:42:25 +0000 |
commit | 55e88120cdad9dc3b5b62cac81b637e921dcdf15 (patch) | |
tree | 4e4458307ac11400ca2ce90dc76d56de2060143b /settings/ajax/lostpassword.php | |
parent | 6d70f42dd432eca06cf73d5fe5f34c3bc3bb924f (diff) | |
download | nextcloud-server-55e88120cdad9dc3b5b62cac81b637e921dcdf15.tar.gz nextcloud-server-55e88120cdad9dc3b5b62cac81b637e921dcdf15.zip |
Validate email on save
Diffstat (limited to 'settings/ajax/lostpassword.php')
-rw-r--r-- | settings/ajax/lostpassword.php | 9 |
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 |