X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f508cfb05f533e5e149db733dfd42b285f452746..36497d8268524daa3edc6d52c82ef3d81112c740:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d83cac0da..9c2787cc8 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -2,8 +2,8 @@ class UserController < ApplicationController layout 'site' before_filter :authorize, :only => [:api_details, :api_gpx_files] - before_filter :set_locale, :except => [:api_details, :api_gpx_files] before_filter :authorize_web, :except => [:api_details, :api_gpx_files] + before_filter :set_locale, :except => [:api_details, :api_gpx_files] before_filter :require_user, :only => [:set_home, :account, :go_public, :make_friend, :remove_friend, :upload_image, :delete_image] before_filter :check_database_readable, :except => [:api_details, :api_gpx_files] before_filter :check_database_writable, :only => [:login, :new, :set_home, :account, :go_public, :make_friend, :remove_friend, :upload_image, :delete_image] @@ -23,8 +23,7 @@ class UserController < ApplicationController @user.data_public = true @user.description = "" if @user.description.nil? @user.creation_ip = request.remote_ip - @user.locale = Language.find_by_code(I18n.locale.to_s) - @user.locale = Language.find_by_code("en") if @user.locale.nil? + @user.languages = request.user_preferred_languages if @user.save flash[:notice] = I18n.t('user.new.flash create success message') @@ -51,10 +50,13 @@ class UserController < ApplicationController end @user.description = params[:user][:description] + @user.languages = params[:user][:languages].split(",") @user.home_lat = params[:user][:home_lat] @user.home_lon = params[:user][:home_lon] if @user.save + set_locale + if params[:user][:email] == @user.new_email flash[:notice] = I18n.t('user.account.flash update success confirm needed') Notifier.deliver_email_confirm(@user, @user.tokens.create)