Commit 187d513c authored by James Lopez's avatar James Lopez

fix specs

parent 0a0d4ac2
...@@ -19,7 +19,7 @@ class Admin::ApplicationsController < Admin::ApplicationController ...@@ -19,7 +19,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
end end
def create def create
@application = Applications::CreateService.new(current_user, application_params) @application = Applications::CreateService.new(current_user, application_params.merge(ip_address: request.remote_ip)).execute
if @application.persisted? if @application.persisted?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
...@@ -51,6 +51,6 @@ class Admin::ApplicationsController < Admin::ApplicationController ...@@ -51,6 +51,6 @@ class Admin::ApplicationsController < Admin::ApplicationController
# Only allow a trusted parameter "white list" through. # Only allow a trusted parameter "white list" through.
def application_params def application_params
params.require(:doorkeeper_application).permit(:name, :redirect_uri, :trusted, :scopes).merge(ip_address: request.remote_ip) params.require(:doorkeeper_application).permit(:name, :redirect_uri, :trusted, :scopes)
end end
end end
...@@ -16,7 +16,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController ...@@ -16,7 +16,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
end end
def create def create
@application = Applications::CreateService.new(current_user, application_params) @application = Applications::CreateService.new(current_user, create_application_params).execute
if @application.persited? if @application.persited?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
...@@ -55,8 +55,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController ...@@ -55,8 +55,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
render "errors/not_found", layout: "errors", status: 404 render "errors/not_found", layout: "errors", status: 404
end end
def application_params def create_application_params
super.tap do |params| application_params.tap do |params|
params[:doorkeeper_application][:owner] = current_user params[:doorkeeper_application][:owner] = current_user
params[:ip_address] = request.remote_ip params[:ip_address] = request.remote_ip
end end
......
...@@ -12,7 +12,7 @@ class Profiles::KeysController < Profiles::ApplicationController ...@@ -12,7 +12,7 @@ class Profiles::KeysController < Profiles::ApplicationController
end end
def create def create
@key = Keys::CreateService.new(current_user, key_params).execute @key = Keys::CreateService.new(current_user, key_params.merge(ip_address: request.remote_ip)).execute
if @key.persisted? if @key.persisted?
redirect_to profile_key_path(@key) redirect_to profile_key_path(@key)
...@@ -54,6 +54,6 @@ class Profiles::KeysController < Profiles::ApplicationController ...@@ -54,6 +54,6 @@ class Profiles::KeysController < Profiles::ApplicationController
private private
def key_params def key_params
params.require(:key).permit(:title, :key).merge(ip_address: request.remote_ip) params.require(:key).permit(:title, :key)
end end
end end
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 to comment