X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7d46f5db6004f1e0555150c3f97c82185d76b837..34fe4c2ac47e5909ba03ae45132ec3c781129679:/app/controllers/users_controller.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 42ac6ac11..23263ebba 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -44,11 +44,9 @@ class UsersController < ApplicationController flash[:notice] = { :partial => "users/terms_declined_flash" } if current_user.save - if params[:referer] - redirect_to safe_referer(params[:referer]) - else - redirect_to user_account_path(current_user) - end + referer = safe_referer(params[:referer]) if params[:referer] + + redirect_to referer || user_account_path(current_user) elsif params[:decline] redirect_to t("users.terms.declined") else @@ -64,11 +62,9 @@ class UsersController < ApplicationController flash[:notice] = t "users.new.terms accepted" if current_user.save end - if params[:referer] - redirect_to safe_referer(params[:referer]) - else - redirect_to user_account_path(current_user) - end + referer = safe_referer(params[:referer]) if params[:referer] + + redirect_to referer || user_account_path(current_user) else self.current_user = session.delete(:new_user) @@ -335,23 +331,15 @@ class UsersController < ApplicationController ## # omniauth failure callback def auth_failure - flash[:error] = t("users.auth_failure.#{params[:message]}") - redirect_to params[:origin] || login_url - end - - private + flash[:error] = t(params[:message], :scope => "users.auth_failure", :default => t("users.auth_failure.unknown_error")) - ## - # - def unconfirmed_login(user) - session[:token] = user.tokens.create.token + origin = safe_referer(params[:origin]) if params[:origin] - redirect_to :action => "confirm", :display_name => user.display_name - - session.delete(:remember_me) - session.delete(:referer) + redirect_to origin || login_url end + private + ## # update a user's details def update_user(user, params)