From ec2446a21388c440a0ddc642dff05c50729e4a50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 19 Apr 2015 23:14:41 +0200 Subject: [PATCH] Ignore new email in RegisterNewActivationCodeForm if user ignores the 'optional' --- .../RegisterNewActivationCodeForm.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 = ''; } } } -- 2.20.1