@@ -181,7 +181,7 @@ public class AccountDAO extends AbstractCRUDDAO<Account> implements SqlViewSearc | |||||
} | } | ||||
if (context instanceof Account) { | if (context instanceof Account) { | ||||
final Account previousState = (Account) context; | final Account previousState = (Account) context; | ||||
if (previousState.isHashedPasswordChanged() && !previousState.skipSyncPassword()) { | |||||
if (account.syncPassword() && previousState.isHashedPasswordChanged() && !previousState.skipSyncPassword()) { | |||||
syncPasswordService.syncPassword(account); | syncPasswordService.syncPassword(account); | ||||
} | } | ||||
} | } | ||||
@@ -82,7 +82,7 @@ import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx; | |||||
@Entity @NoArgsConstructor @Accessors(chain=true) @Slf4j | @Entity @NoArgsConstructor @Accessors(chain=true) @Slf4j | ||||
public class Account extends IdentifiableBaseParentEntity implements TokenPrincipal, SqlViewSearchResult { | public class Account extends IdentifiableBaseParentEntity implements TokenPrincipal, SqlViewSearchResult { | ||||
public static final String[] UPDATE_FIELDS = {"url", "description", "autoUpdatePolicy"}; | |||||
public static final String[] UPDATE_FIELDS = {"url", "description", "autoUpdatePolicy", "syncPassword"}; | |||||
public static final String[] ADMIN_UPDATE_FIELDS = ArrayUtil.append(UPDATE_FIELDS, "suspended", "admin"); | public static final String[] ADMIN_UPDATE_FIELDS = ArrayUtil.append(UPDATE_FIELDS, "suspended", "admin"); | ||||
public static final String[] CREATE_FIELDS = ArrayUtil.append(ADMIN_UPDATE_FIELDS, | public static final String[] CREATE_FIELDS = ArrayUtil.append(ADMIN_UPDATE_FIELDS, | ||||
"name", "termsAgreed", "preferredPlan"); | "name", "termsAgreed", "preferredPlan"); | ||||
@@ -169,6 +169,10 @@ public class Account extends IdentifiableBaseParentEntity implements TokenPrinci | |||||
@Getter @Setter private Long termsAgreed; | @Getter @Setter private Long termsAgreed; | ||||
public Account setTermsAgreed() { return setTermsAgreed(now()); } | public Account setTermsAgreed() { return setTermsAgreed(now()); } | ||||
@ECField(index=130) | |||||
@Getter @Setter private Boolean syncPassword; | |||||
public boolean syncPassword() { return syncPassword == null ? true : syncPassword; } | |||||
@JsonIgnore @Embedded @Getter private HashedPassword hashedPassword; | @JsonIgnore @Embedded @Getter private HashedPassword hashedPassword; | ||||
public Account setHashedPassword (HashedPassword newPass) { | public Account setHashedPassword (HashedPassword newPass) { | ||||
this.hashedPassword = newPass; | this.hashedPassword = newPass; | ||||
@@ -35,6 +35,10 @@ public class NotificationHandler_sync_password extends ReceivedNotificationHandl | |||||
reportError("sync_password: account not found: "+notification.getAccountUuid()); | reportError("sync_password: account not found: "+notification.getAccountUuid()); | ||||
return; | return; | ||||
} | } | ||||
if (!account.syncPassword()) { | |||||
log.info("sync_password: account "+account.getName()+" has syncPassword disabled, not synchronizing"); | |||||
return; | |||||
} | |||||
account.getHashedPassword().setHashedPassword(notification.getHashedPassword()); | account.getHashedPassword().setHashedPassword(notification.getHashedPassword()); | ||||
@@ -10,7 +10,11 @@ import bubble.auth.PromoCodePolicy; | |||||
import bubble.client.BubbleApiClient; | import bubble.client.BubbleApiClient; | ||||
import bubble.cloud.CloudServiceDriver; | import bubble.cloud.CloudServiceDriver; | ||||
import bubble.dao.account.AccountDAO; | import bubble.dao.account.AccountDAO; | ||||
import bubble.dao.bill.AccountPlanDAO; | |||||
import bubble.dao.bill.BubblePlanDAO; | |||||
import bubble.dao.cloud.CloudServiceDAO; | import bubble.dao.cloud.CloudServiceDAO; | ||||
import bubble.model.bill.AccountPlan; | |||||
import bubble.model.bill.BubblePlan; | |||||
import bubble.model.cloud.*; | import bubble.model.cloud.*; | ||||
import bubble.model.device.DeviceSecurityLevel; | import bubble.model.device.DeviceSecurityLevel; | ||||
import bubble.server.listener.BubbleFirstTimeListener; | import bubble.server.listener.BubbleFirstTimeListener; | ||||
@@ -38,7 +42,10 @@ import org.cobbzilla.wizard.cache.redis.HasRedisConfiguration; | |||||
import org.cobbzilla.wizard.cache.redis.RedisConfiguration; | import org.cobbzilla.wizard.cache.redis.RedisConfiguration; | ||||
import org.cobbzilla.wizard.client.ApiClientBase; | import org.cobbzilla.wizard.client.ApiClientBase; | ||||
import org.cobbzilla.wizard.server.RestServerHarness; | import org.cobbzilla.wizard.server.RestServerHarness; | ||||
import org.cobbzilla.wizard.server.config.*; | |||||
import org.cobbzilla.wizard.server.config.HasDatabaseConfiguration; | |||||
import org.cobbzilla.wizard.server.config.LegalInfo; | |||||
import org.cobbzilla.wizard.server.config.PgRestServerConfiguration; | |||||
import org.cobbzilla.wizard.server.config.RecaptchaConfig; | |||||
import org.cobbzilla.wizard.util.ClasspathScanner; | import org.cobbzilla.wizard.util.ClasspathScanner; | ||||
import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||
import org.springframework.context.annotation.Configuration; | import org.springframework.context.annotation.Configuration; | ||||
@@ -92,6 +99,7 @@ public class BubbleConfiguration extends PgRestServerConfiguration | |||||
public static final String TAG_RESTORING_IN_PROGRESS = "restoreInProgress"; | public static final String TAG_RESTORING_IN_PROGRESS = "restoreInProgress"; | ||||
public static final String TAG_JAR_VERSION = "jarVersion"; | public static final String TAG_JAR_VERSION = "jarVersion"; | ||||
public static final String TAG_JAR_UPGRADE_AVAILABLE = "jarUpgradeAvailable"; | public static final String TAG_JAR_UPGRADE_AVAILABLE = "jarUpgradeAvailable"; | ||||
public static final String TAG_MAX_USERS = "maxUsers"; | |||||
public static final String DEFAULT_LOCAL_STORAGE_DIR = HOME_DIR + "/.bubble_local_storage"; | public static final String DEFAULT_LOCAL_STORAGE_DIR = HOME_DIR + "/.bubble_local_storage"; | ||||
@@ -336,6 +344,8 @@ public class BubbleConfiguration extends PgRestServerConfiguration | |||||
final AccountDAO accountDAO = getBean(AccountDAO.class); | final AccountDAO accountDAO = getBean(AccountDAO.class); | ||||
final CloudServiceDAO cloudDAO = getBean(CloudServiceDAO.class); | final CloudServiceDAO cloudDAO = getBean(CloudServiceDAO.class); | ||||
final ActivationService activationService = getBean(ActivationService.class); | final ActivationService activationService = getBean(ActivationService.class); | ||||
final AccountPlan accountPlan = thisNetwork == null ? null : getBean(AccountPlanDAO.class).findByNetwork(thisNetwork.getUuid()); | |||||
final BubblePlan plan = accountPlan == null ? null : getBean(BubblePlanDAO.class).findByUuid(accountPlan.getPlan()); | |||||
publicSystemConfigs.set(MapBuilder.build(new Object[][]{ | publicSystemConfigs.set(MapBuilder.build(new Object[][]{ | ||||
{TAG_ALLOW_REGISTRATION, thisNetwork == null ? null : thisNetwork.getBooleanTag(TAG_ALLOW_REGISTRATION, false)}, | {TAG_ALLOW_REGISTRATION, thisNetwork == null ? null : thisNetwork.getBooleanTag(TAG_ALLOW_REGISTRATION, false)}, | ||||
@@ -357,7 +367,8 @@ public class BubbleConfiguration extends PgRestServerConfiguration | |||||
{TAG_SUPPORT, getSupport()}, | {TAG_SUPPORT, getSupport()}, | ||||
{TAG_SECURITY_LEVELS, DeviceSecurityLevel.values()}, | {TAG_SECURITY_LEVELS, DeviceSecurityLevel.values()}, | ||||
{TAG_JAR_VERSION, getVersion()}, | {TAG_JAR_VERSION, getVersion()}, | ||||
{TAG_JAR_UPGRADE_AVAILABLE, getJarUpgradeAvailable() ? getSageVersion() : null} | |||||
{TAG_JAR_UPGRADE_AVAILABLE, getJarUpgradeAvailable() ? getSageVersion() : null}, | |||||
{TAG_MAX_USERS, plan == null ? null : plan.getMaxAccounts()} | |||||
})); | })); | ||||
} else { | } else { | ||||
// some things has to be refreshed all the time in some cases: | // some things has to be refreshed all the time in some cases: | ||||
@@ -39,6 +39,10 @@ public class StandardSyncPasswordService implements SyncPasswordService { | |||||
log.info("syncPassword: not syncing non-admin password"); | log.info("syncPassword: not syncing non-admin password"); | ||||
return; | return; | ||||
} | } | ||||
if (!account.syncPassword()) { | |||||
log.info("syncPassword: password sync disabled for account: "+account.getName()); | |||||
return; | |||||
} | |||||
final AnsibleInstallType installType = thisNetwork.getInstallType(); | final AnsibleInstallType installType = thisNetwork.getInstallType(); | ||||
final SyncPasswordNotification notification = new SyncPasswordNotification(account); | final SyncPasswordNotification notification = new SyncPasswordNotification(account); | ||||
if (installType == AnsibleInstallType.sage) { | if (installType == AnsibleInstallType.sage) { | ||||
@@ -0,0 +1,2 @@ | |||||
ALTER TABLE account ADD COLUMN sync_password BOOLEAN; | |||||
UPDATE account set sync_password = true; |
@@ -25,9 +25,9 @@ field_label_url=URL | |||||
field_label_administrator=Administrator | field_label_administrator=Administrator | ||||
field_label_suspended=Suspended | field_label_suspended=Suspended | ||||
field_label_sendWelcomeEmail=Send Welcome Email | field_label_sendWelcomeEmail=Send Welcome Email | ||||
field_label_auto_update_policy=Auto-Update Policy | |||||
field_label_auto_update_policy=Automatic Upgrades | |||||
field_label_auto_update_jar=Automatic Updates for Bubble Software | field_label_auto_update_jar=Automatic Updates for Bubble Software | ||||
field_label_auto_update_apps=Automatic Updates for Apps | |||||
field_label_auto_update_apps=Automatic Updates for VPN Apps | |||||
button_label_update_profile=Update | button_label_update_profile=Update | ||||
link_label_change_password=Change Password | link_label_change_password=Change Password | ||||
link_label_account_ssh_keys=Manage SSH Keys | link_label_account_ssh_keys=Manage SSH Keys | ||||
@@ -1 +1 @@ | |||||
Subproject commit 44dab2f86b4922d22099ef2330c083f84879d918 | |||||
Subproject commit 74117dccae90c8905c8f4f54d16fcf19ce5eb27e |