Fix missing LRP token during LRP period behavior

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137321673
This commit is contained in:
ctingue 2016-10-26 14:40:20 -07:00 committed by Ben McIlwain
parent 1ac0832c79
commit 21c0b43af0
4 changed files with 23 additions and 29 deletions

View file

@ -239,13 +239,10 @@ public final class DomainApplicationCreateFlow extends LoggedInFlow implements T
DomainApplicationIndex.createUpdatedInstance(newApplication),
EppResourceIndex.create(Key.create(newApplication)));
// Anchor tenant registrations override LRP, and landrush applications can skip it.
// If a token is passed in outside of an LRP phase, it is simply ignored (i.e. never redeemed).
if (registry.getLrpPeriod().contains(now) && !isAnchorTenant) {
// TODO(b/32059212): This is a bug: empty tokens should still fail. Preserving to fix in a
// separate targeted change.
if (!authInfo.getPw().getValue().isEmpty()) {
entitiesToSave.add(
prepareMarkedLrpTokenEntity(authInfo.getPw().getValue(), domainName, historyEntry));
}
entitiesToSave.add(
prepareMarkedLrpTokenEntity(authInfo.getPw().getValue(), domainName, historyEntry));
}
ofy().save().entities(entitiesToSave.build());
return createOutput(

View file

@ -267,15 +267,12 @@ public class DomainCreateFlow extends LoggedInFlow implements TransactionalFlow
newDomain,
ForeignKeyIndex.create(newDomain, newDomain.getDeletionTime()),
EppResourceIndex.create(Key.create(newDomain)));
// Anchor tenant registrations override LRP, and landrush applications can skip it.
// If a token is passed in outside of an LRP phase, it is simply ignored (i.e. never redeemed).
if (hasLrpToken(registry, isAnchorTenant)) {
// TODO(b/32059212): This is a bug: empty tokens should still fail. Preserving to fix in a
// separate targeted change.
if (!authInfo.getPw().getValue().isEmpty()) {
entitiesToSave.add(
prepareMarkedLrpTokenEntity(authInfo.getPw().getValue(), domainName, historyEntry));
}
if (isLrpCreate(registry, isAnchorTenant)) {
entitiesToSave.add(
prepareMarkedLrpTokenEntity(authInfo.getPw().getValue(), domainName, historyEntry));
}
enqueueTasks(hasSignedMarks, hasClaimsNotice, newDomain);
ofy().save().entities(entitiesToSave.build());
@ -386,7 +383,7 @@ public class DomainCreateFlow extends LoggedInFlow implements TransactionalFlow
.build();
}
private boolean hasLrpToken(Registry registry, boolean isAnchorTenant) {
private boolean isLrpCreate(Registry registry, boolean isAnchorTenant) {
return registry.getLrpPeriod().contains(now) && !isAnchorTenant;
}

View file

@ -278,12 +278,11 @@ public final class TldSpecificLogicProxy {
// domain-name-to-assignee match.
if (!lrpToken.isEmpty()) {
LrpTokenEntity token = ofy().load().key(Key.create(LrpTokenEntity.class, lrpToken)).now();
if (token != null) {
if (token.getAssignee().equalsIgnoreCase(domainName.toString())
if (token != null
&& token.getAssignee().equalsIgnoreCase(domainName.toString())
&& token.getRedemptionHistoryEntry() == null
&& token.getValidTlds().contains(domainName.parent().toString())) {
return Optional.of(token);
}
}
}
return Optional.<LrpTokenEntity>absent();