Skip to content

Commit 4f8bcdd

Browse files
committed
Allow users to login with case-sensitive usernames if pre-existing
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent 141750b commit 4f8bcdd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/src/com/mirth/connect/server/controllers/DefaultUserController.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,16 @@ public User getUser(Integer userId, String userName) throws ControllerException
103103
User user = new User();
104104
user.setId(userId);
105105
user.setUsername(userName);
106-
return SqlConfig.getInstance().getReadOnlySqlSessionManager().selectOne("User.getUser", user);
106+
List<User> list = SqlConfig.getInstance().getReadOnlySqlSessionManager().selectList("User.getUser", user);
107+
// If we have multiple results, we want to prefer the case sensitive match
108+
if (userName != null) {
109+
for (User u : list) {
110+
if (userName.equals(u.getUsername())) {
111+
return u;
112+
}
113+
}
114+
}
115+
return list.isEmpty() ? null : list.get(0);
107116
} catch (PersistenceException e) {
108117
throw new ControllerException(e);
109118
} finally {

0 commit comments

Comments
 (0)