From 40b7897e4b1811f9dec61a13aaeca26f51ae3e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 26 Feb 2021 11:30:17 +0200 Subject: [PATCH] Registrant API: Permit country_code param --- app/controllers/api/v1/registrant/auth_controller.rb | 2 +- app/models/registrant_user.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/registrant/auth_controller.rb b/app/controllers/api/v1/registrant/auth_controller.rb index 8c72106d00..728ef696d4 100644 --- a/app/controllers/api/v1/registrant/auth_controller.rb +++ b/app/controllers/api/v1/registrant/auth_controller.rb @@ -40,7 +40,7 @@ def eid_params obj.require(key) end - params.permit(required_params) + params.permit(required_params + [:country_code]) end def create_token(user) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index efcb082880..227ae8cbfd 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -76,7 +76,7 @@ def find_or_create_by_api_data(user_data = {}) return false unless user_data[:last_name] user_data[:country_code] ||= 'EE' - %i[ident country_code].each { |f| user_data[f].upcase! if user_data[f].is_a?(String) } + user_data[:country_code].upcase! if user_data[:country_code].is_a?(String) find_or_create_by_user_data(user_data) end