@@ -531,6 +531,7 @@ public function addUser(
531531 $ generatePasswordResetToken = true ;
532532 }
533533
534+ $ email = mb_strtolower (trim ($ email ));
534535 if ($ email === '' && $ this ->config ->getAppValue ('core ' , 'newUser.requireEmail ' , 'no ' ) === 'yes ' ) {
535536 throw new OCSException ($ this ->l10n ->t ('Required email address was not provided ' ), 110 );
536537 }
@@ -577,7 +578,7 @@ public function addUser(
577578
578579 // Send new user mail only if a mail is set
579580 if ($ email !== '' ) {
580- $ newUser ->setEMailAddress ($ email );
581+ $ newUser ->setSystemEMailAddress ($ email );
581582 if ($ this ->config ->getAppValue ('core ' , 'newUser.sendEmail ' , 'yes ' ) === 'yes ' ) {
582583 try {
583584 $ emailTemplate = $ this ->newUserMailHelper ->generateTemplate ($ newUser , $ generatePasswordResetToken );
@@ -837,6 +838,7 @@ public function editUserMultiValue(
837838 $ mailCollection = $ userAccount ->getPropertyCollection (IAccountManager::COLLECTION_EMAIL );
838839 $ mailCollection ->removePropertyByValue ($ key );
839840 if ($ value !== '' ) {
841+ $ value = mb_strtolower (trim ($ value ));
840842 $ mailCollection ->addPropertyWithDefaults ($ value );
841843 $ property = $ mailCollection ->getPropertyByValue ($ key );
842844 if ($ isAdminOrSubadmin && $ property ) {
@@ -1119,13 +1121,15 @@ public function editUser(string $userId, string $key, string $value): DataRespon
11191121 }
11201122 break ;
11211123 case IAccountManager::PROPERTY_EMAIL :
1124+ $ value = mb_strtolower (trim ($ value ));
11221125 if (filter_var ($ value , FILTER_VALIDATE_EMAIL ) || $ value === '' ) {
1123- $ targetUser ->setEMailAddress ($ value );
1126+ $ targetUser ->setSystemEMailAddress ($ value );
11241127 } else {
11251128 throw new OCSException ('' , 101 );
11261129 }
11271130 break ;
11281131 case IAccountManager::COLLECTION_EMAIL :
1132+ $ value = mb_strtolower (trim ($ value ));
11291133 if (filter_var ($ value , FILTER_VALIDATE_EMAIL ) && $ value !== $ targetUser ->getSystemEMailAddress ()) {
11301134 $ userAccount = $ this ->accountManager ->getAccount ($ targetUser );
11311135 $ mailCollection = $ userAccount ->getPropertyCollection (IAccountManager::COLLECTION_EMAIL );
0 commit comments