mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Rename users.password
to users.plain_text_password
Otherwise it conflicts with Devise
This commit is contained in:
parent
22e70e7707
commit
32ecf36057
19 changed files with 32 additions and 24 deletions
|
@ -4,7 +4,7 @@ module Repp
|
|||
prefix :repp
|
||||
|
||||
http_basic do |username, password|
|
||||
@current_user ||= ApiUser.find_by(username: username, password: password)
|
||||
@current_user ||= ApiUser.find_by(username: username, plain_text_password: password)
|
||||
if @current_user
|
||||
true
|
||||
else
|
||||
|
|
|
@ -32,7 +32,7 @@ module Admin
|
|||
end
|
||||
|
||||
def update
|
||||
params[:api_user].delete(:password) if params[:api_user][:password].blank?
|
||||
params[:api_user].delete(:plain_text_password) if params[:api_user][:plain_text_password].blank?
|
||||
if @api_user.update(api_user_params)
|
||||
flash[:notice] = I18n.t('record_updated')
|
||||
redirect_to [:admin, @api_user]
|
||||
|
@ -59,7 +59,7 @@ module Admin
|
|||
end
|
||||
|
||||
def api_user_params
|
||||
params.require(:api_user).permit(:username, :password, :active,
|
||||
params.require(:api_user).permit(:username, :plain_text_password, :active,
|
||||
:registrar_id, :registrar_typeahead,
|
||||
:identity_code, { roles: [] })
|
||||
end
|
||||
|
|
|
@ -81,7 +81,7 @@ class Epp::SessionsController < EppController
|
|||
|
||||
if success
|
||||
if params[:parsed_frame].css('newPW').first
|
||||
unless @api_user.update(password: params[:parsed_frame].css('newPW').first.text)
|
||||
unless @api_user.update(plain_text_password: params[:parsed_frame].css('newPW').first.text)
|
||||
response.headers['X-EPP-Returncode'] = '2500'
|
||||
handle_errors(@api_user) and return
|
||||
end
|
||||
|
@ -128,7 +128,7 @@ class Epp::SessionsController < EppController
|
|||
def login_params
|
||||
user = params[:parsed_frame].css('clID').first.text
|
||||
pw = params[:parsed_frame].css('pw').first.text
|
||||
{ username: user, password: pw }
|
||||
{ username: user, plain_text_password: pw }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -22,7 +22,7 @@ class Registrar
|
|||
return nil unless current_registrar_user
|
||||
@depp_current_user ||= Depp::User.new(
|
||||
tag: current_registrar_user.username,
|
||||
password: current_registrar_user.password
|
||||
password: current_registrar_user.plain_text_password
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class Registrar
|
|||
uri = URI.parse("#{ENV['repp_url']}domain_transfers")
|
||||
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
||||
request.body = { data: { domainTransfers: domain_transfers } }.to_json
|
||||
request.basic_auth(current_registrar_user.username, current_registrar_user.password)
|
||||
request.basic_auth(current_registrar_user.username, current_registrar_user.plain_text_password)
|
||||
|
||||
|
||||
if Rails.env.test?
|
||||
|
|
|
@ -12,7 +12,7 @@ class Registrar
|
|||
attributes: { hostname: params[:new_hostname],
|
||||
ipv4: ipv4,
|
||||
ipv6: ipv6 } } }.to_json
|
||||
request.basic_auth(current_registrar_user.username, current_registrar_user.password)
|
||||
request.basic_auth(current_registrar_user.username, current_registrar_user.plain_text_password)
|
||||
|
||||
if Rails.env.test?
|
||||
response = Net::HTTP.start(uri.hostname, uri.port,
|
||||
|
|
|
@ -26,7 +26,8 @@ class Registrar
|
|||
@depp_user.errors.add(:base, :webserver_client_cert_directive_should_be_required)
|
||||
end
|
||||
|
||||
@api_user = ApiUser.find_by(username: params[:depp_user][:tag], password: params[:depp_user][:password])
|
||||
@api_user = ApiUser.find_by(username: params[:depp_user][:tag],
|
||||
plain_text_password: params[:depp_user][:password])
|
||||
|
||||
unless @api_user
|
||||
@depp_user.errors.add(:base, t(:no_such_user))
|
||||
|
|
|
@ -8,7 +8,7 @@ class Registrar
|
|||
request = Net::HTTP::Patch.new(uri)
|
||||
request.set_form_data(current_contact_id: params[:current_contact_id],
|
||||
new_contact_id: params[:new_contact_id])
|
||||
request.basic_auth(current_registrar_user.username, current_registrar_user.password)
|
||||
request.basic_auth(current_registrar_user.username, current_registrar_user.plain_text_password)
|
||||
|
||||
if Rails.env.test?
|
||||
response = Net::HTTP.start(uri.hostname, uri.port,
|
||||
|
|
|
@ -7,7 +7,7 @@ class ApiUser < User
|
|||
def epp_code_map
|
||||
{
|
||||
'2306' => [ # Parameter policy error
|
||||
[:password, :blank]
|
||||
[:plain_text_password, :blank]
|
||||
]
|
||||
}
|
||||
end
|
||||
|
@ -20,8 +20,8 @@ class ApiUser < User
|
|||
belongs_to :registrar
|
||||
has_many :certificates
|
||||
|
||||
validates :username, :password, :registrar, :roles, presence: true
|
||||
validates :password, length: { minimum: min_password_length }
|
||||
validates :username, :plain_text_password, :registrar, :roles, presence: true
|
||||
validates :plain_text_password, length: { minimum: min_password_length }
|
||||
validates :username, uniqueness: true
|
||||
|
||||
delegate :code, :name, to: :registrar, prefix: true
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
.col-md-4.control-label
|
||||
= f.label :password, nil, class: 'required'
|
||||
.col-md-7
|
||||
= f.text_field :password, required: true, class: 'form-control'
|
||||
= f.text_field :plain_text_password, required: true, class: 'form-control'
|
||||
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
%dd= @api_user.username
|
||||
|
||||
%dt= t(:password)
|
||||
%dd= @api_user.password
|
||||
%dd= @api_user.plain_text_password
|
||||
|
||||
%dt= t(:registrar_name)
|
||||
%dd= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue