aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/webapp/WEB-INF/app/views
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-06-23 09:54:55 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-06-29 08:41:53 +0200
commitb91b2032f4b4814812fd6d0a40bce8a0e85d0870 (patch)
treebe4ee5a03bb0311e6f93aad82c2d5edf55a4c465 /server/sonar-web/src/main/webapp/WEB-INF/app/views
parent2ec26550db9c30a64f114acdee307f51775dd944 (diff)
downloadsonarqube-b91b2032f4b4814812fd6d0a40bce8a0e85d0870.tar.gz
sonarqube-b91b2032f4b4814812fd6d0a40bce8a0e85d0870.zip
SONAR-7732 UserSession throws UnauthorizedException if null
If user is not authorized (bad credentials, not authenticated when force authentication is true, etc.) the UserSession will throw an UnauthorizedException in order for rails to be able to deal with this use case (redirect to login page, render 401 in WS,etc.)
Diffstat (limited to 'server/sonar-web/src/main/webapp/WEB-INF/app/views')
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb6
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb2
2 files changed, 4 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
index 66c5645c688..30673cc211b 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
@@ -26,9 +26,9 @@
<%# The two lines below mean that before full removal of Rails, we have to find a way to handle config properties %>
window.SS = {
hoursInDay: <%= configuration('sonar.technicalDebt.hoursInDay', 8) %>,
- user: '<%= escape_javascript current_user.login if current_user -%>',
- userName: '<%= escape_javascript current_user.name if current_user -%>',
- userEmail: '<%= escape_javascript current_user.email if current_user -%>',
+ user: '<%= escape_javascript current_user.login if logged_in? -%>',
+ userName: '<%= escape_javascript current_user.name if logged_in? -%>',
+ userEmail: '<%= escape_javascript current_user.email if logged_in? -%>',
lf: {
enableGravatar: <%= configuration('sonar.lf.enableGravatar', true) %>,
gravatarServerUrl: '<%= configuration('sonar.lf.gravatarServerUrl') %>'
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb
index 88a863b31d4..a99e21339f7 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb
@@ -18,6 +18,6 @@
window.sonarqube.space = 'settings';
<% end %>
- window.SS.isUserAdmin = <%= current_user && is_admin? ? 'true' : 'false' -%>;
+ window.SS.isUserAdmin = <%= logged_in? && is_admin? ? 'true' : 'false' -%>;
})();
</script>