diff --git a/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java b/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java index 648d8390cd03..949df3989be7 100644 --- a/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java +++ b/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java @@ -1906,7 +1906,11 @@ public static Password createPassword(boolean resetLogons, boolean resetOtpSecre password.setShowOtpRegistrationInfo(false); } if (!resetOtpSecret && password.getOtpType() != null && lastPassword != null) { - resetOtpSecret = !password.getOtpType().equals(lastPassword.getOtpType()); + if (lastPassword.getEncryptedOtpSecret() != null && lastPassword.getEncryptedOtpSecret().length > 0) { + resetOtpSecret = !password.getOtpType().equals(lastPassword.getOtpType()); + } else { + resetOtpSecret = true; + } } if (resetOtpSecret) { if (password.getOtpType() != null) {