Skip to content

Commit

Permalink
GUACAMOLE-1068: Generate random key at each login if key is unconfirmed.
Browse files Browse the repository at this point in the history
  • Loading branch information
necouchman committed Apr 12, 2024
1 parent 0e12f48 commit 854a7e2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ private UserTOTPKey getKey(UserContext context,

// If no key is defined, attempt to generate a new key
String secret = attributes.get(TOTPUser.TOTP_KEY_SECRET_ATTRIBUTE_NAME);
if (secret == null || secret.isEmpty()) {
boolean confirmed = "true".equals(attributes.get(TOTPUser.TOTP_KEY_CONFIRMED_ATTRIBUTE_NAME));
if (secret == null || secret.isEmpty() || !confirmed) {

// Generate random key for user
TOTPGenerator.Mode mode = confService.getMode();
Expand Down Expand Up @@ -140,7 +141,6 @@ private UserTOTPKey getKey(UserContext context,
}

// Otherwise, parse value from attributes
boolean confirmed = "true".equals(attributes.get(TOTPUser.TOTP_KEY_CONFIRMED_ATTRIBUTE_NAME));
return new UserTOTPKey(username, key, confirmed);

}
Expand Down

0 comments on commit 854a7e2

Please sign in to comment.