diff --git a/customize.dist/pages/register.js b/customize.dist/pages/register.js index cf05defa5..1bd26ff47 100644 --- a/customize.dist/pages/register.js +++ b/customize.dist/pages/register.js @@ -10,13 +10,14 @@ define([ var urlArgs = Config.requireConf.urlArgs; var tos = $(UI.createCheckbox('accept-terms')).find('.cp-checkmark-label').append(Msg.register_acceptTerms).parent()[0]; + + var termsLink = Pages.customURLs.terms; $(tos).find('a').attr({ - href: '/terms.html', + href: termsLink, // '/terms.html', target: '_blank', tabindex: '-1', }); - var frame = function (content) { return [ h('div#cp-main', [ @@ -38,6 +39,11 @@ define([ ]); } + var termsCheck; + if (termsLink) { + termsCheck = h('div.checkbox-container', tos); + } + return frame([ h('div.row.cp-register-det', [ h('div#data.hidden.col-md-6', [ @@ -72,9 +78,7 @@ define([ h('div.checkbox-container', [ UI.createCheckbox('import-recent', Msg.register_importRecent, true) ]), - h('div.checkbox-container', [ - tos, - ]), + termsCheck, h('button#register', Msg.login_register) ]) ]), diff --git a/www/register/main.js b/www/register/main.js index 8edbaab92..fa26f38b4 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -11,9 +11,10 @@ define([ '/common/common-feedback.js', '/common/outer/local-store.js', '/common/hyperscript.js', + '/customize/pages.js', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', -], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) { +], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h, Pages) { if (window.top !== window) { return; } var Messages = Cryptpad.Messages; $(function () { @@ -58,7 +59,14 @@ define([ var confirmPassword = $confirm.val(); var shouldImport = $checkImport[0].checked; - var doesAccept = $checkAcceptTerms[0].checked; + var doesAccept; + try { + // if this throws there's either a horrible bug (which someone will report) + // or the instance admins did not configure a terms page. + doesAccept = $checkAcceptTerms[0].checked; + } catch (err) { + console.error(err); + } if (Cred.isEmail(uname) && !I_REALLY_WANT_TO_USE_MY_EMAIL_FOR_MY_USERNAME) { var emailWarning = [ @@ -94,7 +102,7 @@ define([ return void UI.alert(Messages.register_passwordsDontMatch); } - if (!doesAccept) { // do they accept the terms of service? + if (Pages.customURLs.terms && !doesAccept) { // do they accept the terms of service? (if they exist) return void UI.alert(Messages.register_mustAcceptTerms); }