From: Tim Düsterhus Date: Sun, 19 Apr 2015 21:14:41 +0000 (+0200) Subject: Ignore new email in RegisterNewActivationCodeForm if user ignores the 'optional' X-Git-Tag: 2.1.4~64^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ec2446a21388c440a0ddc642dff05c50729e4a50;p=GitHub%2FWoltLab%2FWCF.git Ignore new email in RegisterNewActivationCodeForm if user ignores the 'optional' --- diff --git a/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php b/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php index 0efc11f53b..813e741f3c 100644 --- a/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php +++ b/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php @@ -111,13 +111,19 @@ class RegisterNewActivationCodeForm extends AbstractForm { */ public function validateEmail() { if (!empty($this->email)) { - if (!UserRegistrationUtil::isValidEmail($this->email)) { - throw new UserInputException('email', 'notValid'); + // check whether user entered the same email, instead of leaving the input empty + if (mb_strtolower($this->email) != mb_strtolower($this->user->email)) { + if (!UserRegistrationUtil::isValidEmail($this->email)) { + throw new UserInputException('email', 'notValid'); + } + + // Check if email exists already. + if (!UserUtil::isAvailableEmail($this->email)) { + throw new UserInputException('email', 'notUnique'); + } } - - // Check if email exists already. - if (!UserUtil::isAvailableEmail($this->email)) { - throw new UserInputException('email', 'notUnique'); + else { + $this->email = ''; } } }