don't show a checkbox for the terms of service if they don't exist
This commit is contained in:
parent
c65f6b6c16
commit
14f6d65c7a
2 changed files with 20 additions and 8 deletions
|
@ -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)
|
||||
])
|
||||
]),
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue