From 43c61bca60016cad5d3fae210fd57622b40225a8 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 7 Jan 2019 14:50:20 +0100
Subject: [PATCH] Add locale param to sign-up API (#9747)

Fix #9627
---
 app/controllers/api/v1/accounts_controller.rb | 2 +-
 app/services/app_sign_up_service.rb           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index 6e4084c4e..2ccbc3cbb 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -76,7 +76,7 @@ class Api::V1::AccountsController < Api::BaseController
   end
 
   def account_params
-    params.permit(:username, :email, :password, :agreement)
+    params.permit(:username, :email, :password, :agreement, :locale)
   end
 
   def check_enabled_registrations
diff --git a/app/services/app_sign_up_service.rb b/app/services/app_sign_up_service.rb
index 1878587e8..d621cc462 100644
--- a/app/services/app_sign_up_service.rb
+++ b/app/services/app_sign_up_service.rb
@@ -4,7 +4,7 @@ class AppSignUpService < BaseService
   def call(app, params)
     return unless allowed_registrations?
 
-    user_params    = params.slice(:email, :password, :agreement)
+    user_params    = params.slice(:email, :password, :agreement, :locale)
     account_params = params.slice(:username)
     user           = User.create!(user_params.merge(created_by_application: app, password_confirmation: user_params[:password], account_attributes: account_params))