@@ -207,20 +213,24 @@ class Register extends React.Component {
return;
}
- // Validate that the terms have been accepted
- if (this.terms.value !== termsState.accepted.value) {
+ // Validate that the terms have been accepted, if required
+ let acceptedTerms;
+ if (branding.register.tosRequired && this.terms.value !== termsState.accepted.value) {
runInAction(() => {
this.errors.form = termsErrorText;
this.formProcessing = false;
});
return;
}
+ if (branding.register.tosRequired) {
+ acceptedTerms = new Date().toISOString();
+ }
const result = await registerUser({
firstName: this.user.firstName,
lastName: this.user.lastName,
email: this.user.email,
- acceptedTerms: new Date().toISOString(),
+ acceptedTerms,
});
// if we encounter an error then don't continue to process the form and instead display a message
if (result.error) {
diff --git a/main/config/settings/example.yml b/main/config/settings/example.yml
index 022684a95e..e4d85b2cfa 100644
--- a/main/config/settings/example.yml
+++ b/main/config/settings/example.yml
@@ -157,5 +157,11 @@ HostedZoneId: 'Z02455261RJ9QQPVHFZGA'
#userRegistrationSuccess: "
Your Service Workbench account has been successfully created. What you should expect next:
- The Service Workbench administrator will review your account.
- Once your account is activated, you can login to Service Workbench and start your research.
"
#loginWarning: "WARNING: You are entering a secure environment."
+# Require the TOS to be accepted before registration can occur.
+#tosRequired: true
+
+# Should the TOS link be enabled on the landing page.
+#tosLinkOnLanding: true
+
# URL for help link
#helpUrl: about:blank
\ No newline at end of file
diff --git a/main/solution/post-deployment/config/infra/functions.yml b/main/solution/post-deployment/config/infra/functions.yml
index 6b871858e4..4bb1012f2f 100644
--- a/main/solution/post-deployment/config/infra/functions.yml
+++ b/main/solution/post-deployment/config/infra/functions.yml
@@ -42,6 +42,8 @@ postDeployment:
APP_STUDY_DATA_BUCKET_NAME: ${self:custom.settings.studyDataBucketName}
APP_ENABLE_NATIVE_USER_POOL_USERS: ${self:custom.settings.enableNativeUserPoolUsers}
APP_ENABLE_CUSTOM_REGISTRATION: ${self:custom.settings.enableCustomRegistration}
+ APP_TOS_LINK_ON_LANDING : ${self:custom.settings.tosLinkOnLanding}
+ APP_USER_REGISTRATION_TOS_REQUIRED: ${self:custom.settings.tosRequired}
APP_AUTO_CONFIRM_NATIVE_USERS: ${self:custom.settings.autoConfirmNativeUsers}
APP_NATIVE_ADMIN_PASSWORD_PARAM_NAME: ${self:custom.settings.nativeAdminPasswordParamName}
APP_ENV_NAME: ${self:custom.settings.envName}
diff --git a/main/solution/post-deployment/config/settings/.defaults.yml b/main/solution/post-deployment/config/settings/.defaults.yml
index eed64ce4dd..9f6cc110ff 100644
--- a/main/solution/post-deployment/config/settings/.defaults.yml
+++ b/main/solution/post-deployment/config/settings/.defaults.yml
@@ -36,6 +36,12 @@ enableUserSignUps: true
# Please also include the registration parameters to customize the registration page.
enableCustomRegistration: false
+# Require the TOS to be accepted before registration can occur.
+tosRequired: true
+
+# Should the TOS link be enabled on the landing page.
+tosLinkOnLanding: true
+
# Cognito domain prefix. Note random string will be padded at the end if specified domain is not available
cognitoUserPoolDomainPrefix: ${self:custom.settings.envName}-${self:custom.settings.solutionName}
diff --git a/main/solution/ui/config/environment/env-template.yml b/main/solution/ui/config/environment/env-template.yml
index 08e1f7cfd0..a4dd23453b 100644
--- a/main/solution/ui/config/environment/env-template.yml
+++ b/main/solution/ui/config/environment/env-template.yml
@@ -26,6 +26,8 @@ REACT_APP_USER_REGISTRATION_SUMMARY: ${self:custom.settings.userRegistrationSumm
REACT_APP_USER_REGISTRATION_SUCCESS: ${self:custom.settings.userRegistrationSuccess}
REACT_APP_LOGIN_WARNING: ${self:custom.settings.loginWarning}
REACT_APP_HELP_URL: ${self:custom.settings.helpUrl}
+REACT_APP_USER_REGISTRATION_TOS_REQUIRED: ${self:custom.settings.tosRequired}
+REACT_APP_TOS_LINK_ON_LANDING: ${self:custom.settings.tosLinkOnLanding}
# ========================================================================
# Overrides for .env.local
diff --git a/main/solution/ui/config/settings/.defaults.yml b/main/solution/ui/config/settings/.defaults.yml
index f8ca55d08c..6aad9fa6f1 100644
--- a/main/solution/ui/config/settings/.defaults.yml
+++ b/main/solution/ui/config/settings/.defaults.yml
@@ -34,3 +34,9 @@ userRegistrationTitle: "WELCOME TO SERVICE WORKBENCH"
userRegistrationSummary: "
Service Workbench provides a self-service, three-click, on-demand service for researchers to build research environments in minutes without needing cloud infrastructure knowledge. Fill out the form below to create your account on Service Workbench hosted on AWS.
"
userRegistrationSuccess: "
Your Service Workbench account has been successfully created. What you should expect next:
- The Service Workbench administrator will review your account.
- Once your account is activated, you can login to Service Workbench and start your research.
"
loginWarning: ""
+
+# Require the TOS to be accepted before registration can occur.
+tosRequired: true
+
+# Should the TOS link be enabled on the landing page.
+tosLinkOnLanding: true