Merge branch 'stable-2.15' into stable-2.16

* stable-2.15:
  AccountIT: Test that account is not created with invalid email
  CreateAccount: Fail early when invalid SSH key is given
  Use base url for commentlink

Change-Id: Ifac43208ba54ffcc012e1ff9374272466555bfbc
This commit is contained in:
David Pursehouse
2019-08-27 19:51:59 +09:00
5 changed files with 65 additions and 10 deletions

View File

@@ -131,6 +131,16 @@ public class CreateAccount
}
extIds.add(ExternalId.createUsername(username, accountId, input.httpPassword));
if (input.sshKey != null) {
try {
authorizedKeys.addKey(accountId, input.sshKey);
sshKeyCache.evict(username);
} catch (InvalidSshKeyException e) {
throw new BadRequestException(e.getMessage());
}
}
for (AccountExternalIdCreator c : externalIdCreators) {
extIds.addAll(c.create(accountId, username, input.email));
}
@@ -163,15 +173,6 @@ public class CreateAccount
}
}
if (input.sshKey != null) {
try {
authorizedKeys.addKey(accountId, input.sshKey);
sshKeyCache.evict(username);
} catch (InvalidSshKeyException e) {
throw new BadRequestException(e.getMessage());
}
}
AccountLoader loader = infoLoader.create(true);
AccountInfo info = loader.get(accountId);
loader.fill();