From be972912cba5f42197b13c4c3ee0c61effe3a34d Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sun, 27 Aug 2017 12:15:32 +0530 Subject: [PATCH] FIX: do not show full name field when accepting invite if full names are disabled https://meta.discourse.org/t/require-password-for-trusted-user-invites/13750/58?u=techapj --- .../discourse/controllers/invites-show.js.es6 | 5 +++++ .../javascripts/discourse/templates/invites/show.hbs | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 b/app/assets/javascripts/discourse/controllers/invites-show.js.es6 index 20e533ec0c5..15acf96dddd 100644 --- a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invites-show.js.es6 @@ -38,6 +38,11 @@ export default Ember.Controller.extend(PasswordValidation, UsernameValidation, N return usernameFailed || passwordFailed || nameFailed || userFieldsFailed; }, + @computed + fullnameRequired() { + return this.siteSettings.full_name_required || this.siteSettings.enable_names; + }, + actions: { submit() { diff --git a/app/assets/javascripts/discourse/templates/invites/show.hbs b/app/assets/javascripts/discourse/templates/invites/show.hbs index ade57c9d262..65c775087b6 100644 --- a/app/assets/javascripts/discourse/templates/invites/show.hbs +++ b/app/assets/javascripts/discourse/templates/invites/show.hbs @@ -30,11 +30,13 @@
{{i18n 'user.username.instructions'}}
-
- - {{input value=accountName id="new-account-name" name="name"}} -
{{nameInstructions}}
-
+ {{#if fullnameRequired}} +
+ + {{input value=accountName id="new-account-name" name="name"}} +
{{nameInstructions}}
+
+ {{/if}}