mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 21:27:16 -05:00
Add site setting tos_accept_required. If enabled, users must check a box saying that they've read and accept the terms of service.
This commit is contained in:
@@ -17,6 +17,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
|
||||
rejectedEmails: Em.A([]),
|
||||
rejectedPasswords: Em.A([]),
|
||||
prefilledUsername: null,
|
||||
tosAccepted: false,
|
||||
|
||||
resetForm: function() {
|
||||
this.setProperties({
|
||||
@@ -36,12 +37,13 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
|
||||
|
||||
submitDisabled: function() {
|
||||
if (this.get('formSubmitted')) return true;
|
||||
if (this.get('tosAcceptRequired') && !this.get('tosAccepted')) return true;
|
||||
if (this.get('nameValidation.failed')) return true;
|
||||
if (this.get('emailValidation.failed')) return true;
|
||||
if (this.get('usernameValidation.failed')) return true;
|
||||
if (this.get('passwordValidation.failed')) return true;
|
||||
return false;
|
||||
}.property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed', 'formSubmitted'),
|
||||
}.property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed', 'formSubmitted', 'tosAccepted'),
|
||||
|
||||
passwordRequired: function() {
|
||||
return (this.blank('authOptions.auth_provider') || this.blank('authOptions.email_valid') || !this.get('authOptions.email_valid'));
|
||||
@@ -322,6 +324,10 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
|
||||
});
|
||||
},
|
||||
|
||||
tosAcceptRequired: function() {
|
||||
return Discourse.SiteSettings.tos_accept_required;
|
||||
}.property(),
|
||||
|
||||
actions: {
|
||||
createAccount: function() {
|
||||
var self = this;
|
||||
|
||||
@@ -67,6 +67,12 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
{{#if tosAcceptRequired}}
|
||||
<div class="tos-agree">
|
||||
{{input type="checkbox" checked=tosAccepted}}
|
||||
{{customHTML "tos_signup_form_message"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<button class='btn btn-large btn-primary' {{bind-attr disabled="submitDisabled"}} {{action createAccount}}>{{i18n create_account.title}}</button>
|
||||
{{#if formSubmitted}}
|
||||
<i class='fa fa-spinner fa-spin'></i>
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
}
|
||||
|
||||
.create-account {
|
||||
form {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -56,4 +59,8 @@
|
||||
.fa-spinner {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.tos-agree {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user