mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 09:08:26 +01:00
update for redirection to last page and other refinements.
This commit is contained in:
parent
83aa56a1e4
commit
81363ad1fb
@ -44,13 +44,14 @@
|
||||
}
|
||||
|
||||
function getProjectSuccess(data, status) {
|
||||
vm.projects = data || [];
|
||||
vm.projects = data;
|
||||
|
||||
if(!angular.isDefined(vm.projects)) {
|
||||
if(vm.projects == null) {
|
||||
vm.isPublic = 1;
|
||||
vm.publicity = 1;
|
||||
vm.publicity = true;
|
||||
vm.projectType = 'public_projects';
|
||||
console.log('vm.projects is undefined, load public projects.');
|
||||
console.log('vm.projects is null, load public projects.');
|
||||
return;
|
||||
}
|
||||
|
||||
if(angular.isArray(vm.projects) && vm.projects.length > 0) {
|
||||
@ -78,9 +79,9 @@
|
||||
}
|
||||
|
||||
function getProjectFailed() {
|
||||
// $scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
// $scope.$emit('modalMessage', $filter('tr')('failed_to_get_project'));
|
||||
// $scope.$emit('raiseError', true);
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_to_get_project'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed to list projects.');
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
.module('harbor.sign.in')
|
||||
.directive('signIn', signIn);
|
||||
|
||||
SignInController.$inject = ['SignInService', 'LogOutService', 'currentUser', 'I18nService', '$window', '$scope'];
|
||||
function SignInController(SignInService, LogOutService, currentUser, I18nService, $window, $scope) {
|
||||
SignInController.$inject = ['SignInService', 'LogOutService', 'currentUser', 'I18nService', '$window', '$scope', 'getParameterByName', '$location'];
|
||||
function SignInController(SignInService, LogOutService, currentUser, I18nService, $window, $scope, getParameterByName, $location) {
|
||||
var vm = this;
|
||||
|
||||
vm.hasError = false;
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
vm.doContinue = doContinue;
|
||||
vm.doLogOut = doLogOut;
|
||||
|
||||
|
||||
vm.signInTIP = false;
|
||||
|
||||
function reset() {
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
function doSignIn(user) {
|
||||
if(user && angular.isDefined(user.principal) && angular.isDefined(user.password)) {
|
||||
vm.lastUrl = getParameterByName('last_url', $location.absUrl());
|
||||
vm.signInTIP = true;
|
||||
SignInService(user.principal, user.password)
|
||||
.success(signedInSuccess)
|
||||
@ -38,6 +39,10 @@
|
||||
}
|
||||
|
||||
function signedInSuccess(data, status) {
|
||||
if(vm.lastUrl) {
|
||||
$window.location.href = vm.lastUrl;
|
||||
return;
|
||||
}
|
||||
$window.location.href = "/dashboard";
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
.filter('dateL', localizeDate)
|
||||
.filter('tr', tr);
|
||||
|
||||
RedirectInterceptorService.$inject = ['$q', '$window'];
|
||||
RedirectInterceptorService.$inject = ['$q', '$window', '$location'];
|
||||
|
||||
function RedirectInterceptorService($q, $window) {
|
||||
function RedirectInterceptorService($q, $window, $location) {
|
||||
return {
|
||||
'responseError': function(rejection) {
|
||||
var url = rejection.config.url;
|
||||
@ -55,7 +55,7 @@
|
||||
}
|
||||
}
|
||||
if(!isExcluded && rejection.status === 401) {
|
||||
$window.location.href = '/';
|
||||
$window.location.href = '/?last_url=' + encodeURIComponent(location.pathname + '#' + $location.url());
|
||||
return;
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
|
@ -22,6 +22,10 @@
|
||||
vm.cancel = cancel;
|
||||
|
||||
$scope.user = currentUser.get();
|
||||
if(!$scope.user) {
|
||||
$window.location.href = '/';
|
||||
return;
|
||||
}
|
||||
var userId = $scope.user.user_id;
|
||||
|
||||
//Error message dialog handler for account setting.
|
||||
|
@ -23,6 +23,10 @@
|
||||
vm.cancel = cancel;
|
||||
|
||||
$scope.user = currentUser.get();
|
||||
if(!$scope.user) {
|
||||
$window.location.href = '/';
|
||||
return;
|
||||
}
|
||||
var userId = $scope.user.user_id;
|
||||
|
||||
//Error message dialog handler for account setting.
|
||||
|
Loading…
Reference in New Issue
Block a user