mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -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:
parent
d769938660
commit
e0df404d7e
8 changed files with 40 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -211,8 +211,10 @@ class ApplicationController < ActionController::Base
|
|||
def custom_html_json
|
||||
MultiJson.dump({
|
||||
top: SiteContent.content_for(:top),
|
||||
bottom: SiteContent.content_for(:bottom),
|
||||
})
|
||||
bottom: SiteContent.content_for(:bottom)
|
||||
}.merge(
|
||||
(SiteSetting.tos_accept_required && !current_user) ? {tos_signup_form_message: SiteContent.content_for(:tos_signup_form_message)} : {}
|
||||
))
|
||||
end
|
||||
|
||||
def render_json_error(obj)
|
||||
|
|
|
@ -18,6 +18,7 @@ class SiteContent < ActiveRecord::Base
|
|||
add_content_type :tos_user_content_license, default_18n_key: 'terms_of_service.user_content_license'
|
||||
add_content_type :tos_miscellaneous, default_18n_key: 'terms_of_service.miscellaneous'
|
||||
add_content_type :login_required_welcome_message, default_18n_key: 'login_required.welcome_message'
|
||||
add_content_type :tos_signup_form_message, default_18n_key: 'terms_of_service.signup_form_message', format: :html
|
||||
add_content_type :privacy_policy, allow_blank: true
|
||||
add_content_type :faq, allow_blank: true
|
||||
add_content_type :top, allow_blank: true, format: :html
|
||||
|
|
|
@ -1547,6 +1547,7 @@ en:
|
|||
rate_limits: 'Rate Limits'
|
||||
developer: 'Developer'
|
||||
embedding: "Embedding"
|
||||
legal: "Legal"
|
||||
uncategorized: 'Uncategorized'
|
||||
|
||||
lightbox:
|
||||
|
|
|
@ -527,6 +527,9 @@ en:
|
|||
bottom:
|
||||
title: "Bottom of the pages"
|
||||
description: "HTML that will be added at the bottom of every pages"
|
||||
tos_signup_form_message:
|
||||
title: "Signup Form: Terms of Service Message"
|
||||
description: "The message that will appear beside a checkbox on the signup form if the tos_accept_required site setting is enabled."
|
||||
|
||||
site_settings:
|
||||
default_locale: "The default language of this Discourse instance (ISO 639-1 Code)"
|
||||
|
@ -798,6 +801,7 @@ en:
|
|||
embed_by_username: "Discourse username of the user who creates the topics"
|
||||
embed_category: "Category of created topics"
|
||||
embed_post_limit: "Maximum number of posts to embed"
|
||||
tos_accept_required: "If enabled, users will need to check a box on the signup form to confirm that they accept the terms of service. Edit 'Signup Form: Terms of Service Message' in the Content tab to change the message."
|
||||
|
||||
notification_types:
|
||||
mentioned: "%{display_username} mentioned you in %{link}"
|
||||
|
@ -1291,6 +1295,7 @@ en:
|
|||
user_content_license: |
|
||||
User contributions are licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US). Without limiting any of those representations or warranties, %{company_short_name} has the right (though not the obligation) to, in %{company_short_name}’s sole discretion (i) refuse or remove any content that, in %{company_short_name}’s reasonable opinion, violates any %{company_short_name} policy or is in any way harmful or objectionable, or (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in %{company_short_name}’s sole discretion. %{company_short_name} will have no obligation to provide a refund of any amounts previously paid.
|
||||
miscellaneous: "This Agreement constitutes the entire agreement between %{company_short_name} and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of %{company_short_name}, or by the posting by %{company_short_name} of a revised version. Except to the extent applicable law, if any, provides otherwise, this Agreement, any access to or use of the Website will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions, and the proper venue for any disputes arising out of or relating to any of the same will be the state and federal courts located in San Francisco County, California. Except for claims for injunctive or equitable relief or claims regarding intellectual property rights (which may be brought in any competent court without the posting of a bond), any dispute arising under this Agreement shall be finally settled in accordance with the Comprehensive Arbitration Rules of the Judicial Arbitration and Mediation Service, Inc. (“JAMS”) by three arbitrators appointed in accordance with such Rules. The arbitration shall take place in San Francisco, California, in the English language and the arbitral decision may be enforced in any court. The prevailing party in any action or proceeding to enforce this Agreement shall be entitled to costs and attorneys’ fees. If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect. A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms and conditions; %{company_short_name} may assign its rights under this Agreement without condition. This Agreement will be binding upon and will inure to the benefit of the parties, their successors and permitted assigns."
|
||||
signup_form_message: 'I have read and accept the <a href="/tos" target="_blank">Terms of Service</a>.'
|
||||
|
||||
deleted: 'deleted'
|
||||
|
||||
|
|
|
@ -365,14 +365,20 @@ embedding:
|
|||
embed_category: ''
|
||||
embed_post_limit: 100
|
||||
|
||||
uncategorized:
|
||||
legal:
|
||||
tos_url:
|
||||
client: true
|
||||
default: ''
|
||||
faq_url:
|
||||
privacy_policy_url:
|
||||
client: true
|
||||
default: ''
|
||||
privacy_policy_url:
|
||||
tos_accept_required:
|
||||
client: true
|
||||
default: false
|
||||
|
||||
uncategorized:
|
||||
|
||||
faq_url:
|
||||
client: true
|
||||
default: ''
|
||||
|
||||
|
|
Loading…
Reference in a new issue