use \OC_Mail::validateAddress() to validate the email address - fixes #7862

This commit is contained in:
Thomas Müller 2014-03-24 15:35:07 +01:00
parent fb7f3008d3
commit 3eb5898f7b
3 changed files with 3 additions and 3 deletions

View file

@ -125,7 +125,7 @@ class OC_Mail {
* @param string $emailAddress a given email address to be validated
* @return bool
*/
public static function ValidateAddress($emailAddress) {
public static function validateAddress($emailAddress) {
$emailAddress = self::buildAsciiEmail($emailAddress);
return PHPMailer::ValidateAddress($emailAddress);
}

View file

@ -266,7 +266,7 @@ class Util {
$host_name = \OC_Config::getValue('mail_domain', $host_name);
$defaultEmailAddress = $user_part.'@'.$host_name;
if (\OC_Mail::ValidateAddress($defaultEmailAddress)) {
if (\OC_Mail::validateAddress($defaultEmailAddress)) {
return $defaultEmailAddress;
}

View file

@ -6,7 +6,7 @@ OCP\JSON::callCheck();
$l=OC_L10N::get('core');
// Get data
if( isset( $_POST['email'] ) && filter_var( $_POST['email'], FILTER_VALIDATE_EMAIL) ) {
if( isset( $_POST['email'] ) && OC_Mail::validateAddress($_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 saved") )));