You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2018/10/09 09:09:21 UTC

[17/27] lucene-solr:solr7896-login-page: WIP - login screen now works, but static always require login.

WIP - login screen now works, but static always require login.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/90dcf6ed
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/90dcf6ed
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/90dcf6ed

Branch: refs/heads/solr7896-login-page
Commit: 90dcf6eda70610eb32652ba7257b9f3656558f82
Parents: 5bb585c
Author: Jan Høydahl <ja...@apache.org>
Authored: Tue Sep 25 00:40:33 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Tue Sep 25 00:40:33 2018 +0200

----------------------------------------------------------------------
 solr/webapp/web/index.html                      |  2 +-
 solr/webapp/web/js/angular/app.js               |  5 +++++
 solr/webapp/web/js/angular/controllers/login.js | 21 +++++++++++---------
 solr/webapp/web/js/angular/services.js          | 16 +++++++--------
 solr/webapp/web/partials/login.html             | 10 ++++------
 5 files changed, 30 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/90dcf6ed/solr/webapp/web/index.html
----------------------------------------------------------------------
diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.html
index f36dc13..d832155 100644
--- a/solr/webapp/web/index.html
+++ b/solr/webapp/web/index.html
@@ -23,7 +23,7 @@ limitations under the License.
   <link rel="icon" type="image/x-icon" href="img/favicon.ico?_=${version}">
   <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico?_=${version}">
 
-  <link rel="stylesheet" type="text/css" href="css/bootstrap-3.3/bootstrap.min.css?_=${version}">
+  <!--<link rel="stylesheet" type="text/css" href="css/bootstrap-3.3/bootstrap.min.css?_=${version}">-->
   <link rel="stylesheet" type="text/css" href="css/angular/common.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/angular/analysis.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/angular/cloud.css?_=${version}">

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/90dcf6ed/solr/webapp/web/js/angular/app.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index a0bc4ab..71dd98b 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -410,10 +410,13 @@ solrAdminApp.config([
   // so that the browser will not interfer with the login dialogue
   $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
 })
+    
+    
 // NOCOMMIT: just for testing     
 .run(['$rootScope', '$location', '$cookieStore', '$http',
   function ($rootScope, $location, $cookieStore, $http) {
     // keep user logged in after page refresh
+    // Replace with interceptor
     $rootScope.globals = $cookieStore.get('globals') || {};
     if ($rootScope.globals.currentUser) {
       $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line
@@ -426,6 +429,8 @@ solrAdminApp.config([
       }
     });
   }])
+
+    
 .directive('fileModel', function ($parse) {
   return {
     restrict: 'A',

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/90dcf6ed/solr/webapp/web/js/angular/controllers/login.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/controllers/login.js b/solr/webapp/web/js/angular/controllers/login.js
index b0b7096..653ca14 100644
--- a/solr/webapp/web/js/angular/controllers/login.js
+++ b/solr/webapp/web/js/angular/controllers/login.js
@@ -23,14 +23,17 @@ solrAdminApp.controller('LoginController',
 
         $scope.login = function () {
           $scope.dataLoading = true;
-          AuthenticationService.Login($scope.username, $scope.password, function (response) {
-            if (response.success) {
-              AuthenticationService.SetCredentials($scope.username, $scope.password);
-              $location.path('/');
-            } else {
-              $scope.error = response.message;
-              $scope.dataLoading = false;
-            }
-          });
+          AuthenticationService.SetCredentials($scope.username, $scope.password);
+          $location.path('/');
+          // TODO: "login" by hitting the failing URL again
+          // AuthenticationService.Login($scope.username, $scope.password, function (response) {
+          //   if (response.success) {
+          //     AuthenticationService.SetCredentials($scope.username, $scope.password);
+          //     $location.path('/');
+          //   } else {
+          //     $scope.error = response.message;
+          //     $scope.dataLoading = false;
+          //   }
+          // });
         };
       }]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/90dcf6ed/solr/webapp/web/js/angular/services.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.js
index ffd7135..b6df864 100644
--- a/solr/webapp/web/js/angular/services.js
+++ b/solr/webapp/web/js/angular/services.js
@@ -272,18 +272,18 @@ solrAdminServices.factory('System',
 
           /* NOCOMMIT Dummy authentication for testing, uses $timeout to simulate api call
            ----------------------------------------------*/
-          $timeout(function () {
-            var response = { success: username === 'test' && password === 'test' };
-            if (!response.success) {
-              response.message = 'Username or password is incorrect';
-            }
-            callback(response);
-          }, 1000);
+          // $timeout(function () {
+          //   var response = { success: username === 'test' && password === 'test' };
+          //   if (!response.success) {
+          //     response.message = 'Username or password is incorrect';
+          //   }
+          //   callback(response);
+          // }, 1000);
 
 
           /* Use this for real authentication
            ----------------------------------------------*/
-          //$http.post('/api/authenticate', { username: username, password: password })
+          // $http.post('/api/authenticate', { username: username, password: password })
           //    .success(function (response) {
           //        callback(response);
           //    });

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/90dcf6ed/solr/webapp/web/partials/login.html
----------------------------------------------------------------------
diff --git a/solr/webapp/web/partials/login.html b/solr/webapp/web/partials/login.html
index cae1cc8..65be563 100644
--- a/solr/webapp/web/partials/login.html
+++ b/solr/webapp/web/partials/login.html
@@ -14,13 +14,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
-<div id="login" class="jumbotron">
-
+<div id="login">
   <div class="col-xs-offset-2 col-xs-8">
-    <div class="alert alert-info">
-      Username: test<br />
-      Password: test
-    </div>
+    <h1>Please log in</h1>
+    Basic Authentication 
+    
     <div ng-show="error" class="alert alert-danger">{{error}}</div>
     <form name="form" ng-submit="login()" role="form">
         <div class="form-group">