From ea4315982c612e1d5259edefce123e9eea67c153 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Mon, 6 Feb 2012 23:48:35 +0100 Subject: [PATCH] SONAR-2132 redirect to original URI when user clicks on the link "Login" --- .../src/main/resources/org/sonar/l10n/core.properties | 1 - .../webapp/WEB-INF/app/controllers/sessions_controller.rb | 8 ++++++++ .../webapp/WEB-INF/app/views/layouts/_layout.html.erb | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 1de49ac8c87..4a1e940aca1 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -342,7 +342,6 @@ sessions.new_account=Not a member? Sign up for a sessions.confirm_password=Confirm password sessions.sign_up=Sign up sessions.old_account=Log in if you already have an account. -session.flash_notice.logged_in=Logged in. session.flash_notice.authentication_failed=Authentication failed. session.flash_notice.logged_out=You have been logged out. diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb index 2a05c51db59..81701fbc608 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb @@ -51,4 +51,12 @@ class SessionsController < ApplicationController reset_session end + def new + if params[:return_to] + # user clicked on the link "login" : redirect to the original uri after authentication + session[:return_to] = params[:return_to] + # else the original uri can be set by ApplicationController#access_denied + end + end + end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index f1427291611..5f9b38b33e6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -23,7 +23,7 @@ » <%= message('layout.logout') -%> <% else %> -
  • <%= message('layout.login') -%>
  • +
  • <%= message('layout.login') -%>
  • <% end %>
  • <%= message('layout.configuration') -%>
  • -- 2.39.5