Commit 3e7cb66b authored by michael.simon's avatar michael.simon
Browse files

Change findByEppn return type to list

parent e2f2487c
...@@ -342,11 +342,14 @@ public class UserUpdateServiceImpl implements UserUpdateService, Serializable { ...@@ -342,11 +342,14 @@ public class UserUpdateServiceImpl implements UserUpdateService, Serializable {
} }
private UserEntity findUser(String eppn) { private UserEntity findUser(String eppn) {
UserEntity user = userDao.findByEppn(eppn); List<UserEntity> userList = userDao.findByEppn(eppn);
if (userList.size() == 0)
return null;
else if (userList.size() > 1)
return null;
if (user != null) { UserEntity user = userList.get(0);
user = userDao.findByIdWithStore(user.getId()); user = userDao.findByIdWithStore(user.getId());
}
return user; return user;
} }
......
...@@ -63,9 +63,12 @@ public class TwoFaLoginServiceImpl implements TwoFaLoginService { ...@@ -63,9 +63,12 @@ public class TwoFaLoginServiceImpl implements TwoFaLoginService {
if (eppn != null) { if (eppn != null) {
if (eppn.contains("@")) { if (eppn.contains("@")) {
user = userDao.findByEppn(eppn); List<UserEntity> userList = userDao.findByEppn(eppn);
if (user == null) if (userList.size() == 0)
throw new NoUserFoundException("no such user"); throw new NoUserFoundException("no such user");
else if (userList.size() > 1)
throw new NoUserFoundException("user eppn not unique");
user = userList.get(0);
registry = findRegistry(user, service); registry = findRegistry(user, service);
if (registry == null) if (registry == null)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment