|
|
|
|
@ -537,6 +537,7 @@ class UsersController extends AUserDataOCSController { |
|
|
|
|
$generatePasswordResetToken = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$email = mb_strtolower(trim($email)); |
|
|
|
|
if ($email === '' && $this->config->getAppValue('core', 'newUser.requireEmail', 'no') === 'yes') { |
|
|
|
|
throw new OCSException($this->l10n->t('Required email address was not provided'), 110); |
|
|
|
|
} |
|
|
|
|
@ -583,7 +584,7 @@ class UsersController extends AUserDataOCSController { |
|
|
|
|
|
|
|
|
|
// Send new user mail only if a mail is set |
|
|
|
|
if ($email !== '') { |
|
|
|
|
$newUser->setEMailAddress($email); |
|
|
|
|
$newUser->setSystemEMailAddress($email); |
|
|
|
|
if ($this->config->getAppValue('core', 'newUser.sendEmail', 'yes') === 'yes') { |
|
|
|
|
try { |
|
|
|
|
$emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken); |
|
|
|
|
@ -857,6 +858,7 @@ class UsersController extends AUserDataOCSController { |
|
|
|
|
$mailCollection = $userAccount->getPropertyCollection(IAccountManager::COLLECTION_EMAIL); |
|
|
|
|
$mailCollection->removePropertyByValue($key); |
|
|
|
|
if ($value !== '') { |
|
|
|
|
$value = mb_strtolower(trim($value)); |
|
|
|
|
$mailCollection->addPropertyWithDefaults($value); |
|
|
|
|
$property = $mailCollection->getPropertyByValue($key); |
|
|
|
|
if ($isAdminOrSubadmin && $property) { |
|
|
|
|
@ -1142,13 +1144,15 @@ class UsersController extends AUserDataOCSController { |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case IAccountManager::PROPERTY_EMAIL: |
|
|
|
|
$value = mb_strtolower(trim($value)); |
|
|
|
|
if (filter_var($value, FILTER_VALIDATE_EMAIL) || $value === '') { |
|
|
|
|
$targetUser->setEMailAddress($value); |
|
|
|
|
$targetUser->setSystemEMailAddress($value); |
|
|
|
|
} else { |
|
|
|
|
throw new OCSException('', 101); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case IAccountManager::COLLECTION_EMAIL: |
|
|
|
|
$value = mb_strtolower(trim($value)); |
|
|
|
|
if (filter_var($value, FILTER_VALIDATE_EMAIL) && $value !== $targetUser->getSystemEMailAddress()) { |
|
|
|
|
$userAccount = $this->accountManager->getAccount($targetUser); |
|
|
|
|
$mailCollection = $userAccount->getPropertyCollection(IAccountManager::COLLECTION_EMAIL); |
|
|
|
|
|