From 0e7dfcb6d7c02607649c3f62c35f7319a79d0789 Mon Sep 17 00:00:00 2001
From: Marcelo Schmidt <marcelo.schmidt@konecty.com>
Date: Fri, 4 Mar 2016 16:29:48 -0300
Subject: [PATCH] Fix #766; Disable E-mail Confirmation setting when SMTP is
 not set.

---
 HISTORY.md                                             | 1 +
 i18n/en.i18n.json                                      | 1 +
 packages/rocketchat-lib/server/startup/settings.coffee | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/HISTORY.md b/HISTORY.md
index ff88f547037..82d16a0042f 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -3,6 +3,7 @@
 - Fixes #924. Admin users may now login without verifying their e-mails.
 - Makes channels list load faster by not getting full channel data, such as usernames.
 - Fixes #2399. Fixes bug with highlighted words which allowed an empty string to be defined as highlight.
+- Fix #766; Disable E-mail Confirmation setting when SMTP is not set.
 
 ## 0.20.0, 2016-Feb-29
 
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 8a8b26c1c48..795a18c0f70 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -21,6 +21,7 @@
   "Accounts_AvatarStoreType" : "Avatar Storage Type",
   "Accounts_denyUnverifiedEmail" : "Deny unverified e-mail",
   "Accounts_EmailVerification" : "E-mail Verification",
+  "Accounts_EmailVerification_Description" : "Make sure you have correct SMTP settings to use this feature",
   "Accounts_Enrollment_Email" : "Enrollment E-mail",
   "Accounts_Enrollment_Email_Description" : "You may use [name], [fname], [lname] for the user's full name, first name or last name, respectively.<br />You may use [email] for the user's e-mail.",
   "Accounts_LoginExpiration" : "Login Expiration in Days",
diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee
index f1b305e1fca..3a78e51441a 100644
--- a/packages/rocketchat-lib/server/startup/settings.coffee
+++ b/packages/rocketchat-lib/server/startup/settings.coffee
@@ -16,7 +16,7 @@ RocketChat.settings.addGroup 'Accounts', ->
 	@add 'Accounts_PasswordPlaceholder', '', { type: 'string', public: true, i18nLabel: 'Placeholder_for_password_login_field' }
 
 	@section 'Registration', ->
-		@add 'Accounts_EmailVerification', false, { type: 'boolean', public: true }
+		@add 'Accounts_EmailVerification', false, { type: 'boolean', public: true, enableQuery: {_id: 'SMTP_Host', value: { $exists: 1, $ne: "" } } }
 		@add 'Accounts_ManuallyApproveNewUsers', false, { type: 'boolean' }
 		@add 'Accounts_AllowedDomainsList', '', { type: 'string', public: true }
 		@add 'Accounts_RegistrationForm', 'Public', { type: 'select', public: true, values: [ { key: 'Public', i18nLabel: 'Accounts_RegistrationForm_Public' }, { key: 'Disabled', i18nLabel: 'Accounts_RegistrationForm_Disabled' }, { key: 'Secret URL', i18nLabel: 'Accounts_RegistrationForm_Secret_URL' } ] }
-- 
GitLab