REPP: Show error when invalid ident format submitted

This commit is contained in:
Karl Erik Õunapuu 2020-11-16 16:26:59 +02:00
parent 3d0150076c
commit 03db562c77
No known key found for this signature in database
GPG key ID: C9DD647298A34764
4 changed files with 9 additions and 4 deletions

View file

@ -4,6 +4,7 @@ module Repp
rescue_from ActiveRecord::RecordNotFound, with: :not_found_error
before_action :authenticate_user
before_action :check_ip_restriction
before_action :set_paper_trail_whodunnit
attr_reader :current_user
rescue_from ActionController::ParameterMissing do |exception|

View file

@ -112,7 +112,7 @@ module Repp
end
def contact_ident_params(required: true)
if required || !params[:contact][:ident].nil?
if required
params.require(:contact).require(:ident).require(%i[ident ident_type ident_country_code])
params.require(:contact).require(:ident).permit(:ident, :ident_type, :ident_country_code)
else