X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8d76be71bbb8a799cbf0627dee170f26ade5a11f..0b43f6b5a0646c9fdbdf2371e32001d20d31cc85:/app/controllers/users_controller.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 00d427ac9..38a61208c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -28,9 +28,9 @@ class UsersController < ApplicationController if current_user&.terms_agreed? # Already agreed to terms, so just show settings - redirect_to :action => :account, :display_name => current_user.display_name + redirect_to user_account_path(current_user) elsif current_user.nil? && session[:new_user].nil? - redirect_to :action => :login, :referer => request.fullpath + redirect_to login_path(:referer => request.fullpath) end end end @@ -47,7 +47,7 @@ class UsersController < ApplicationController if params[:referer] redirect_to safe_referer(params[:referer]) else - redirect_to :action => :account, :display_name => current_user.display_name + redirect_to user_account_path(current_user) end elsif params[:decline] redirect_to t("users.terms.declined") @@ -67,7 +67,7 @@ class UsersController < ApplicationController if params[:referer] redirect_to safe_referer(params[:referer]) else - redirect_to :action => :account, :display_name => current_user.display_name + redirect_to user_account_path(current_user) end else self.current_user = session.delete(:new_user) @@ -147,7 +147,7 @@ class UsersController < ApplicationController current_user.data_public = true current_user.save flash[:notice] = t "users.go_public.flash success" - redirect_to :action => "account", :display_name => current_user.display_name + redirect_to user_account_path(current_user) end def new @@ -277,15 +277,15 @@ class UsersController < ApplicationController name = auth_info[:info][:name] email = auth_info[:info][:email] - case provider - when "openid" - email_verified = uid.match(%r{https://www.google.com/accounts/o8/id?(.*)}) || + email_verified = case provider + when "openid" + uid.match(%r{https://www.google.com/accounts/o8/id?(.*)}) || uid.match(%r{https://me.yahoo.com/(.*)}) - when "google", "facebook" - email_verified = true - else - email_verified = false - end + when "google", "facebook" + true + else + false + end if settings = session.delete(:new_user_settings) current_user.auth_provider = provider @@ -297,7 +297,7 @@ class UsersController < ApplicationController session[:user_errors] = current_user.errors.as_json - redirect_to :action => "account", :display_name => current_user.display_name + redirect_to user_account_path(current_user) elsif session[:new_user] session[:new_user].auth_provider = provider session[:new_user].auth_uid = uid @@ -321,9 +321,9 @@ class UsersController < ApplicationController when "active", "confirmed" successful_login(user, request.env["omniauth.params"]["referer"]) when "suspended" - failed_login t("users.login.account is suspended", :webmaster => "mailto:#{Settings.support_email}").html_safe + failed_login t("sessions.new.account is suspended", :webmaster => "mailto:#{Settings.support_email}").html_safe else - failed_login t("users.login.auth failure") + failed_login t("sessions.new.auth failure") end else redirect_to :action => "new", :nickname => name, :email => email, @@ -341,17 +341,6 @@ class UsersController < ApplicationController private - ## - # - def unconfirmed_login(user) - session[:token] = user.tokens.create.token - - redirect_to :action => "confirm", :display_name => user.display_name - - session.delete(:remember_me) - session.delete(:referer) - end - ## # update a user's details def update_user(user, params) @@ -363,34 +352,6 @@ class UsersController < ApplicationController user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation] end - if params[:user][:description] != user.description - user.description = params[:user][:description] - user.description_format = "markdown" - end - - user.languages = params[:user][:languages].split(",") - - case params[:avatar_action] - when "new" - user.avatar.attach(params[:user][:avatar]) - user.image_use_gravatar = false - when "delete" - user.avatar.purge_later - user.image_use_gravatar = false - when "gravatar" - user.avatar.purge_later - user.image_use_gravatar = true - end - - user.home_lat = params[:user][:home_lat] - user.home_lon = params[:user][:home_lon] - - user.preferred_editor = if params[:user][:preferred_editor] == "default" - nil - else - params[:user][:preferred_editor] - end - if params[:user][:auth_provider].nil? || params[:user][:auth_provider].blank? user.auth_provider = nil user.auth_uid = nil @@ -399,8 +360,6 @@ class UsersController < ApplicationController if user.save session[:fingerprint] = user.fingerprint - set_locale(:reset => true) - if user.new_email.blank? || user.new_email == user.email flash[:notice] = t "users.account.flash update success" else