From: Olivier Lamy Date: Thu, 22 Nov 2012 20:27:23 +0000 (+0000) Subject: [MRM-1717] open loginbox when url need authz. X-Git-Tag: archiva-1.4-M4~609 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a18362e7f42b934347c5852a64cf8bc28d94a5dc;p=archiva.git [MRM-1717] open loginbox when url need authz. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1412656 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java index 33ca9723d..91ba7a3e0 100644 --- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java +++ b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java @@ -158,6 +158,7 @@ public class DefaultUserRepositories } AuthenticationResult authn = new AuthenticationResult( true, principal, null ); + authn.setUser( user ); return new DefaultSecuritySession( authn, user ); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/startup.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/startup.js index 4533eeedd..65cb7a4cc 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/startup.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/startup.js @@ -25,6 +25,8 @@ function(jquery,sammy,utils) { //$.log("devMode:"+window.archivaDevMode); + + // no cache for ajax queries as we get datas from servers so preventing caching !! jQuery.ajaxSetup( { cache: false,//!window.archivaDevMode @@ -37,6 +39,9 @@ function(jquery,sammy,utils) { displayErrorMessage($.i18n.prop('authz.karma.needed')); userLogged(function(user){ userLoggedCallbackFn(user); + },function(){ + $.log("not logged"); + loginBox(); }); }, 500: function(data){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js index 3d973a849..899deb4c1 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js @@ -35,7 +35,7 @@ define("redback",["jquery","utils","jquery.validate","jquery.json","knockout", /** * call successFn on success with passing user object coming from cookie */ - userLogged=function(successFn) { + userLogged=function(successFn,notLoggedFn) { // call restServices/redbackServices/loginService/isLogged to know // if a session exists and check the cookie $.log("userLogged"); @@ -48,6 +48,11 @@ define("redback",["jquery","utils","jquery.validate","jquery.json","knockout", if (successFn){ successFn(userLogged ? getUserFromLoginCookie():null); } + if(!userLogged){ + if(notLoggedFn){ + notLoggedFn(); + } + } } }); }