Fix Rubocop warnings

This commit is contained in:
Artur Beljajev 2018-07-15 19:26:43 +03:00
parent 02aad0d781
commit a651ac8cab
13 changed files with 26 additions and 20 deletions

View file

@ -32,7 +32,10 @@ module Admin
end end
def update def update
params[:api_user].delete(:plain_text_password) if params[:api_user][:plain_text_password].blank? if params[:api_user][:plain_text_password].blank?
params[:api_user].delete(:plain_text_password)
end
if @api_user.update(api_user_params) if @api_user.update(api_user_params)
flash[:notice] = I18n.t('record_updated') flash[:notice] = I18n.t('record_updated')
redirect_to [:admin, @api_user] redirect_to [:admin, @api_user]

View file

@ -2,7 +2,6 @@ module Admin
class DashboardController < BaseController class DashboardController < BaseController
authorize_resource class: false authorize_resource class: false
def show def show; end
end
end end
end end

View file

@ -24,11 +24,11 @@ module Admin
private private
def after_sign_in_path_for(resource_or_scope) def after_sign_in_path_for(_resource_or_scope)
admin_root_path admin_root_path
end end
def after_sign_out_path_for(resource_or_scope) def after_sign_out_path_for(_resource_or_scope)
new_admin_user_session_path new_admin_user_session_path
end end

View file

@ -19,7 +19,8 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
domain_name: @domain.name, domain_name: @domain.name,
verification_token: params[:token]) verification_token: params[:token])
initiator = current_registrant_user ? current_registrant_user.username : t(:user_not_authenticated) initiator = current_registrant_user ? current_registrant_user.username :
t(:user_not_authenticated)
if params[:rejected] if params[:rejected]
if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}") if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")

View file

@ -19,7 +19,8 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
domain_name: @domain.name, domain_name: @domain.name,
verification_token: params[:token]) verification_token: params[:token])
initiator = current_registrant_user ? current_registrant_user.username : t(:user_not_authenticated) initiator = current_registrant_user ? current_registrant_user.username :
t(:user_not_authenticated)
if params[:rejected] if params[:rejected]
if @registrant_verification.domain_registrant_change_reject!("email link, #{initiator}") if @registrant_verification.domain_registrant_change_reject!("email link, #{initiator}")

View file

@ -1,8 +1,7 @@
class Registrant::SessionsController < Devise::SessionsController class Registrant::SessionsController < Devise::SessionsController
layout 'registrant/application' layout 'registrant/application'
def new def new; end
end
def id def id
id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O'] id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O']
@ -99,11 +98,11 @@ class Registrant::SessionsController < Devise::SessionsController
private private
def after_sign_in_path_for(resource_or_scope) def after_sign_in_path_for(_resource_or_scope)
registrant_root_path registrant_root_path
end end
def after_sign_out_path_for(resource_or_scope) def after_sign_out_path_for(_resource_or_scope)
new_registrant_user_session_path new_registrant_user_session_path
end end
end end

View file

@ -2,7 +2,6 @@ class Registrar
class DashboardController < BaseController class DashboardController < BaseController
authorize_resource class: false authorize_resource class: false
def show def show; end
end
end end
end end

View file

@ -21,7 +21,8 @@ class Registrar
uri = URI.parse("#{ENV['repp_url']}domain_transfers") uri = URI.parse("#{ENV['repp_url']}domain_transfers")
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = { data: { domainTransfers: domain_transfers } }.to_json request.body = { data: { domainTransfers: domain_transfers } }.to_json
request.basic_auth(current_registrar_user.username, current_registrar_user.plain_text_password) request.basic_auth(current_registrar_user.username,
current_registrar_user.plain_text_password)
if Rails.env.test? if Rails.env.test?

View file

@ -6,7 +6,8 @@ class Registrar
def index def index
params[:q] ||= {} params[:q] ||= {}
invoices = current_registrar_user.registrar.invoices.includes(:invoice_items, :account_activity) invoices = current_registrar_user.registrar.invoices
.includes(:invoice_items, :account_activity)
normalize_search_parameters do normalize_search_parameters do
@q = invoices.search(params[:q]) @q = invoices.search(params[:q])

View file

@ -12,7 +12,8 @@ class Registrar
attributes: { hostname: params[:new_hostname], attributes: { hostname: params[:new_hostname],
ipv4: ipv4, ipv4: ipv4,
ipv6: ipv6 } } }.to_json ipv6: ipv6 } } }.to_json
request.basic_auth(current_registrar_user.username, current_registrar_user.plain_text_password) request.basic_auth(current_registrar_user.username,
current_registrar_user.plain_text_password)
if Rails.env.test? if Rails.env.test?
response = Net::HTTP.start(uri.hostname, uri.port, response = Net::HTTP.start(uri.hostname, uri.port,

View file

@ -171,11 +171,11 @@ class Registrar
render text: t('registrar.authorization.ip_not_allowed', ip: request.ip) render text: t('registrar.authorization.ip_not_allowed', ip: request.ip)
end end
def after_sign_in_path_for(resource_or_scope) def after_sign_in_path_for(_resource_or_scope)
registrar_root_path registrar_root_path
end end
def after_sign_out_path_for(resource_or_scope) def after_sign_out_path_for(_resource_or_scope)
new_registrar_user_session_path new_registrar_user_session_path
end end

View file

@ -8,7 +8,8 @@ class Registrar
request = Net::HTTP::Patch.new(uri) request = Net::HTTP::Patch.new(uri)
request.set_form_data(current_contact_id: params[:current_contact_id], request.set_form_data(current_contact_id: params[:current_contact_id],
new_contact_id: params[:new_contact_id]) new_contact_id: params[:new_contact_id])
request.basic_auth(current_registrar_user.username, current_registrar_user.plain_text_password) request.basic_auth(current_registrar_user.username,
current_registrar_user.plain_text_password)
if Rails.env.test? if Rails.env.test?
response = Net::HTTP.start(uri.hostname, uri.port, response = Net::HTTP.start(uri.hostname, uri.port,

View file

@ -7,7 +7,7 @@ class ApiUser < User
def epp_code_map def epp_code_map
{ {
'2306' => [ # Parameter policy error '2306' => [ # Parameter policy error
[:plain_text_password, :blank] %i[plain_text_password blank]
] ]
} }
end end