Skip to content

Commit

Permalink
Fixing setter for recovery codes, adding creation and update time set…
Browse files Browse the repository at this point in the history
…ting to constructors
  • Loading branch information
Sam Glendenning committed Mar 4, 2022
1 parent f648ec4 commit e7ce000
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ public class IamTotpMfa implements Serializable {
orphanRemoval = true)
private Set<IamTotpRecoveryCode> recoveryCodes = new HashSet<>();

public IamTotpMfa() {}
public IamTotpMfa() {
Date now = new Date();
setCreationTime(now);
setLastUpdateTime(now);
}

public IamTotpMfa(IamAccount account) {
this.account = account;
Date now = new Date();
setCreationTime(now);
setLastUpdateTime(now);
}

public Long getId() {
Expand Down Expand Up @@ -134,12 +141,8 @@ public Set<IamTotpRecoveryCode> getRecoveryCodes() {
}

public void setRecoveryCodes(final Set<IamTotpRecoveryCode> recoveryCodes) {
if (this.recoveryCodes.isEmpty()) {
this.recoveryCodes = recoveryCodes;
} else {
this.recoveryCodes.clear();
this.recoveryCodes.addAll(recoveryCodes);
}
this.recoveryCodes.clear();
this.recoveryCodes.addAll(recoveryCodes);
}

@Override
Expand Down

0 comments on commit e7ce000

Please sign in to comment.