]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1717] open loginbox when url need authz.
authorOlivier Lamy <olamy@apache.org>
Thu, 22 Nov 2012 20:27:23 +0000 (20:27 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 22 Nov 2012 20:27:23 +0000 (20:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1412656 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/startup.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js

index 33ca9723d69a5d84b8aba26737e5b48f46a8933c..91ba7a3e072b7233ef1dbec38f12af485576fc81 100644 (file)
@@ -158,6 +158,7 @@ public class DefaultUserRepositories
         }
 
         AuthenticationResult authn = new AuthenticationResult( true, principal, null );
+        authn.setUser( user );
         return new DefaultSecuritySession( authn, user );
     }
 
index 4533eeedd900f2ad6bd93b330dddfbf4ba7a7f1e..65cb7a4cc91e20699238b03a365d0c21e1318048 100644 (file)
@@ -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){
index 3d973a849e6ca5ac60f74b258f708eb0a658ca31..899deb4c18fdf70ecbf7427ed09d206697fbe99a 100644 (file)
@@ -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();
+          }
+        }
       }
     });
   }