Commit 73f7685a by source_reader

fixed bug for adding joule nodes without a proxy

parent 07bce4d0
...@@ -10,10 +10,13 @@ class AddNilmByKey ...@@ -10,10 +10,13 @@ class AddNilmByKey
required_keys = required_keys =
[:port, :scheme, :base_uri, :name, :api_key, :auth_key] [:port, :scheme, :name, :api_key, :auth_key]
joule_params = request_params.permit(required_keys+[:name_is_host]) joule_params = request_params.permit(required_keys+[:name_is_host, :base_uri])
# since we're not explicitly checking for base_uri, give it a default value
# it should always be present but may be "" which causes the require action to fail
joule_params[:base_uri]="" if joule_params[:base_uri].nil?
begin begin
required_keys.each{|key| joule_params.require(key)} required_keys.each{|key| joule_params.require(key)}
......
...@@ -14,10 +14,14 @@ class AddNilmByUser ...@@ -14,10 +14,14 @@ class AddNilmByUser
#0 make sure parameters are present #0 make sure parameters are present
required_keys = required_keys =
[:port, :scheme, :base_uri, :name, :api_key] + [:port, :scheme, :name, :api_key] +
[:first_name, :last_name, :email, :password] [:first_name, :last_name, :email, :password]
request_params = request_params.permit(required_keys+[:name_is_host]) request_params = request_params.permit(required_keys+[:name_is_host, :base_uri])
# since we're not explicitly checking for base_uri, give it a default value
# it should always be present but may be "" which causes the require action to fail
request_params[:base_uri]="" if request_params[:base_uri].nil?
begin begin
required_keys.each{|key| request_params.require(key)} required_keys.each{|key| request_params.require(key)}
rescue ActionController::ParameterMissing => e rescue ActionController::ParameterMissing => e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment