Skip to content

Commit

Permalink
Fix error throwing on password update (#268)
Browse files Browse the repository at this point in the history
## Usage and product changes

We fix an issue that caused an error to be thrown by password update
commands, in spite of them succeeding

## Implementation

We retrieve the current username before updating the password, so it no
longer relies on the now deauthenticated connection.
  • Loading branch information
sam-butcher authored Dec 17, 2024
1 parent 929f8e9 commit 485aa90
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TypeDBConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,11 @@ private void runREPLMode(CLIOptions options) {
runUserCreate(driver, command.asUserCreate().user(), command.asUserCreate().password());
} else if (command.isUserPasswordUpdate()) {
REPLCommand.User.PasswordUpdate userPasswordUpdate = command.asUserPasswordUpdate();
String username = driver.users().getCurrentUser().name();
boolean passwordUpdateSuccessful = runUserPasswordUpdate(driver,
userPasswordUpdate.user(),
userPasswordUpdate.password());
if (passwordUpdateSuccessful && userPasswordUpdate.user().equals(driver.users().getCurrentUser().name())) {
if (passwordUpdateSuccessful && userPasswordUpdate.user().equals(username)) {
printer.info("Please login again with your updated password.");
break;
}
Expand Down Expand Up @@ -379,10 +380,11 @@ private boolean runInlineCommandMode(CLIOptions options, List<String> inlineComm
if (!success) return false;
} else if (command.isUserPasswordUpdate()) {
REPLCommand.User.PasswordUpdate userPasswordUpdate = command.asUserPasswordUpdate();
String username = driver.users().getCurrentUser().name();
boolean passwordUpdateSuccessful = runUserPasswordUpdate(driver,
userPasswordUpdate.user(),
userPasswordUpdate.password());
if (passwordUpdateSuccessful && userPasswordUpdate.user().equals(driver.users().getCurrentUser().name())) {
if (passwordUpdateSuccessful && userPasswordUpdate.user().equals(username)) {
printer.info("Please login again with your updated password.");
break;
} else return false;
Expand Down

0 comments on commit 485aa90

Please sign in to comment.