Fix registration when allow registration from services is disabled

pull/1523/head
Marcelo Schmidt 11 years ago
parent 8dd046b5a5
commit c8d3fda1d2
  1. 2
      packages/rocketchat-lib/server/functions/settings.coffee
  2. 2
      server/lib/accounts.coffee

@ -13,6 +13,7 @@ RocketChat.settings.add = (_id, value, options = {}) ->
options.packageValue = value
options.valueSource = 'packageValue'
options.ts = new Date
options.hidden = false
if process?.env?[_id]?
value = process.env[_id]
@ -55,6 +56,7 @@ RocketChat.settings.addGroup = (_id, options = {}) ->
options.i18nDescription = "#{_id}_Description"
options.ts = new Date
options.hidden = false
return RocketChat.models.Settings.upsert { _id: _id },
$set: options

@ -108,6 +108,6 @@ Accounts.validateLoginAttempt (login) ->
return true
Accounts.validateNewUser (user) ->
if RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Enabled') is false and user.services?
if RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Enabled') is false and RocketChat.settings.get('LDAP_Enable') is false and not user.services?.password?
throw new Meteor.Error 'registration-disabled-authentication-services', 'User registration is disabled for authentication services'
return true

Loading…
Cancel
Save