Skip to content
Snippets Groups Projects
Commit af2256a8 authored by srosse's avatar srosse
Browse files

OO-1674: write an error message instead of the red screen

parent a417b30a
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ package org.olat.admin.user.imp; ...@@ -26,6 +26,7 @@ package org.olat.admin.user.imp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
...@@ -369,8 +370,14 @@ class ImportStep00 extends BasicStep { ...@@ -369,8 +370,14 @@ class ImportStep00 extends BasicStep {
// check that no user with same (institutional) e-mail is already in OLAT // check that no user with same (institutional) e-mail is already in OLAT
if ( (thisKey.equals(UserConstants.INSTITUTIONALEMAIL) || thisKey.equals(UserConstants.EMAIL)) && !thisValue.isEmpty() ) { if ( (thisKey.equals(UserConstants.INSTITUTIONALEMAIL) || thisKey.equals(UserConstants.EMAIL)) && !thisValue.isEmpty() ) {
// check that no user with same email is already in OLAT // check that no user with same email is already in OLAT
Identity identity = UserManager.getInstance().findIdentityByEmail(thisValue); List<Identity> identities = UserManager.getInstance().findIdentitiesByEmail(Collections.singletonList(thisValue));
if (identity != null && !ud.equals(identity)) { if(identities.size() > 1) {
textAreaElement.setErrorKey("error.email.douplicate", new String[] { String.valueOf(i + 1), thisValue });
importDataError = true;
break;
}
if (identities.size() == 1 && !ud.equals(identities.get(0))) {
textAreaElement.setErrorKey("error.email.exists", new String[] { String.valueOf(i + 1), thisValue }); textAreaElement.setErrorKey("error.email.exists", new String[] { String.valueOf(i + 1), thisValue });
importDataError = true; importDataError = true;
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment