Skip to content

Commit

Permalink
SAK-48251 Users: issue with passwords surrounded by spaces when impor…
Browse files Browse the repository at this point in the history
…ting users from file (sakaiproject#11154)
  • Loading branch information
V100X authored Jan 24, 2023
1 parent 4321185 commit 9b1d999
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions admin-tools/src/java/org/sakaiproject/user/tool/UsersAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,12 @@ public void doImport(RunData data, Context context)
//Try to import the rest
continue;
}

User newUser = userDirectoryService.addUser(null, user.getEid(), user.getFirstName(), user.getLastName(), user.getEmail(), user.getPassword(), user.getType(), user.getProperties());


String userPass = user.getPassword();
// If the password form the CSV is null, set an empty string.
// Else, trim possible spaces surrounding the password, to avoid login problems.
userPass = userPass == null ? "" : userPass.trim();

userDirectoryService.addUser(null, user.getEid(), user.getFirstName(), user.getLastName(), user.getEmail(), userPass, user.getType(), user.getProperties());
}
catch (UserAlreadyDefinedException e){
//ok, just skip
Expand Down

0 comments on commit 9b1d999

Please sign in to comment.