From ddb3dfa92ec0878240211cb2b7a8e125961b1360 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 5 Jan 2013 23:01:16 +0100 Subject: Moved to GsParemeter.get and set defaults for a couple of validations. --- app/controllers/sip_accounts_controller.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/controllers/sip_accounts_controller.rb') diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index 8292a74..4d042b3 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -15,11 +15,11 @@ class SipAccountsController < ApplicationController def new @sip_account = @parent.sip_accounts.build @sip_account.caller_name = @parent - @sip_account.call_waiting = CALL_WAITING - @sip_account.clir = DEFAULT_CLIR_SETTING - @sip_account.clip = DEFAULT_CLIP_SETTING + @sip_account.call_waiting = GsParameter.get('CALL_WAITING') + @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING') + @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING') @sip_account.voicemail_pin = random_pin - @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT + @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT') if @parent.class == User @sip_account.hotdeskable = true end @@ -27,11 +27,11 @@ class SipAccountsController < ApplicationController # Make sure that we don't use an already taken auth_name # loop do - @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME) + @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')) break unless SipAccount.exists?(:auth_name => @sip_account.auth_name) end - @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD) + @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')) end def create @@ -39,13 +39,13 @@ class SipAccountsController < ApplicationController if @sip_account.auth_name.blank? loop do - @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME) + @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')) break unless SipAccount.exists?(:auth_name => @sip_account.auth_name) end end if @sip_account.password.blank? - @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD) + @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')) end if @sip_account.save -- cgit v1.2.3