Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4C47F200ACC for ; Mon, 2 May 2016 15:16:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4B2011609B0; Mon, 2 May 2016 15:16:15 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ED81C1609A1 for ; Mon, 2 May 2016 15:16:13 +0200 (CEST) Received: (qmail 44317 invoked by uid 500); 2 May 2016 13:16:13 -0000 Mailing-List: contact dev-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list dev@syncope.apache.org Received: (qmail 44304 invoked by uid 99); 2 May 2016 13:16:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 May 2016 13:16:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id F180D2C14F9 for ; Mon, 2 May 2016 13:16:12 +0000 (UTC) Date: Mon, 2 May 2016 13:16:12 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@syncope.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SYNCOPE-798) Once authenticated to enduser, "Cancel" brings nowhere MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 02 May 2016 13:16:15 -0000 [ https://issues.apache.org/jira/browse/SYNCOPE-798?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D152= 66583#comment-15266583 ]=20 ASF GitHub Bot commented on SYNCOPE-798: ---------------------------------------- Github user ilgrosso commented on a diff in the pull request: https://github.com/apache/syncope/pull/13#discussion_r61736403 =20 --- Diff: client/enduser/src/main/resources/META-INF/resources/app/js/a= pp.js --- @@ -27,394 +29,409 @@ angular.module('info', []); =20 // Declare app level module which depends on views, and components var app =3D angular.module('SyncopeEnduserApp', [ - 'ui.router', - 'ui.bootstrap', - 'ui.select', - 'ngSanitize', - 'ngAnimate', - 'ngResource', - 'ngCookies', - 'treasure-overlay-spinner', - 'ngPasswordStrength', - 'kendo.directives', - 'home', - 'login', - 'language', - 'self', - 'info' + 'ui.router', + 'ui.bootstrap', + 'ui.select', + 'ngSanitize', + 'ngAnimate', + 'ngResource', + 'ngCookies', + 'treasure-overlay-spinner', + 'ngPasswordStrength', + 'kendo.directives', + 'home', + 'login', + 'language', + 'self', + 'info' ]); =20 app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', - function ($stateProvider, $urlRouterProvider, $httpProvider) { - // route configuration - $stateProvider - .state('home', { - url: '/', - templateUrl: 'views/self.html' - }) - .state('self', { - url: '/self', - templateUrl: 'views/self.html' - }) - .state('user-self-update', { - url: '/user-self-update', - templateUrl: 'views/home.html', - controller: 'HomeController', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('create', { - url: '/self/create', - templateUrl: 'views/editUser.html' - }) - // nested states=20 - // each of these sections will have their own view - // url will be nested (/self/create) - .state('create.credentials', { - url: '/credentials', - templateUrl: 'views/user-credentials.html' - }) - .state('create.groups', { - url: '/groups', - templateUrl: 'views/user-groups.html' - }) - .state('create.plainSchemas', { - url: '/plainSchemas', - templateUrl: 'views/user-plain-schemas.html' - }) - .state('create.derivedSchemas', { - url: '/derivedSchemas', - templateUrl: 'views/user-derived-schemas.html' - }) - .state('create.virtualSchemas', { - url: '/virtualSchemas', - templateUrl: 'views/user-virtual-schemas.html' - }) - .state('create.resources', { - url: '/resources', - templateUrl: 'views/user-resources.html' - }) - .state('create.finish', { - url: '/finish', - templateUrl: 'views/user-form-finish.html' - }) - .state('update', { - url: '/self/update', - templateUrl: 'views/editUser.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - // nested states=20 - // each of these sections will have their own view - // url will be nested (/self/update) - .state('update.credentials', { - url: '/credentials', - templateUrl: 'views/user-credentials.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('update.plainSchemas', { - url: '/plainSchemas', - templateUrl: 'views/user-plain-schemas.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('update.derivedSchemas', { - url: '/derivedSchemas', - templateUrl: 'views/user-derived-schemas.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('update.virtualSchemas', { - url: '/virtualSchemas', - templateUrl: 'views/user-virtual-schemas.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('update.groups', { - url: '/groups', - templateUrl: 'views/user-groups.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('update.resources', { - url: '/resources', - templateUrl: 'views/user-resources.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('update.finish', { - url: '/finish', - templateUrl: 'views/user-form-finish.html', - resolve: { - 'authenticated': function (AuthenticationHelper) { - return AuthenticationHelper.authenticated(); - } - } - }) - .state('passwordreset', { - url: '/passwordreset', - templateUrl: 'views/passwordreset.html' - }) - .state('confirmpasswordreset', { - url: '/confirmpasswordreset?token', - templateUrl: 'views/confirmpasswordreset.html' - }) - .state('mustchangepassword', { - url: '/mustchangepassword', - templateUrl: 'views/mustchangepassword.html' - }); + function ($stateProvider, $urlRouterProvider, $httpProvider) { + // route configuration + $stateProvider + .state('home', { + url: '/', + templateUrl: 'views/self.html' + }) + .state('self', { + url: '/self', + templateUrl: 'views/self.html' + }) + .state('user-self-update', { + url: '/user-self-update', + templateUrl: 'views/home.html', + controller: 'HomeController', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged() + }] + } + }) + .state('create', { + url: '/self/create', + templateUrl: 'views/editUser.html' + }) + // nested states=20 + // each of these sections will have their own view + // url will be nested (/self/create) + .state('create.credentials', { + url: '/credentials', + templateUrl: 'views/user-credentials.html' + }) + .state('create.groups', { + url: '/groups', + templateUrl: 'views/user-groups.html' + }) + .state('create.plainSchemas', { + url: '/plainSchemas', + templateUrl: 'views/user-plain-schemas.html' + }) + .state('create.derivedSchemas', { + url: '/derivedSchemas', + templateUrl: 'views/user-derived-schemas.html' + }) + .state('create.virtualSchemas', { + url: '/virtualSchemas', + templateUrl: 'views/user-virtual-schemas.html' + }) + .state('create.resources', { + url: '/resources', + templateUrl: 'views/user-resources.html' + }) + .state('create.finish', { + url: '/finish', + templateUrl: 'views/user-form-finish.html' + }) + .state('update', { + url: '/self/update', + templateUrl: 'views/editUser.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + // nested states=20 + // each of these sections will have their own view + // url will be nested (/self/update) + .state('update.credentials', { + url: '/credentials', + templateUrl: 'views/user-credentials.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('update.plainSchemas', { + url: '/plainSchemas', + templateUrl: 'views/user-plain-schemas.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('update.derivedSchemas', { + url: '/derivedSchemas', + templateUrl: 'views/user-derived-schemas.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('update.virtualSchemas', { + url: '/virtualSchemas', + templateUrl: 'views/user-virtual-schemas.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('update.groups', { + url: '/groups', + templateUrl: 'views/user-groups.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('update.resources', { + url: '/resources', + templateUrl: 'views/user-resources.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('update.finish', { + url: '/finish', + templateUrl: 'views/user-form-finish.html', + resolve: { + 'authenticated': ['AuthService', + function (AuthService) { + return AuthService.islogged(); + }] + } + }) + .state('passwordreset', { + url: '/passwordreset', + templateUrl: 'views/passwordreset.html' + }) + .state('confirmpasswordreset', { + url: '/confirmpasswordreset?token', + templateUrl: 'views/confirmpasswordreset.html' + }) + .state('mustchangepassword', { + url: '/mustchangepassword', + templateUrl: 'views/mustchangepassword.html' + }); =20 - // catch all other routes - // send users to the home page=20 - $urlRouterProvider.otherwise('/'); + // catch all other routes + // send users to the home page=20 + $urlRouterProvider.otherwise('/'); =20 - // HTTP service configuration - $httpProvider.defaults.withCredentials =3D true; - $httpProvider.defaults.xsrfCookieName =3D 'XSRF-TOKEN'; - $httpProvider.defaults.xsrfHeaderName =3D 'X-XSRF-TOKEN'; - =20 - //SYNCOPE-780 - $httpProvider.defaults.headers.common["If-Modified-Since"] =3D "0"= ; + // HTTP service configuration + $httpProvider.defaults.withCredentials =3D true; + $httpProvider.defaults.xsrfCookieName =3D 'XSRF-TOKEN'; + $httpProvider.defaults.xsrfHeaderName =3D 'X-XSRF-TOKEN'; =20 - $httpProvider.interceptors.push(function ($q, $rootScope, $locatio= n) { - var numLoadings =3D 0; - return { - 'request': function (config, a, b) { - //if the url is an html, we're changing page - if (config.url.indexOf('.html', config.url.length - 5) =3D= =3D -1) { - $rootScope.$broadcast("xhrStarted"); - } - $rootScope.spinner.on(); - return config || $q.when(config); - }, - 'response': function (response) { - //$http.pendingRequests.length - $rootScope.spinner.off(); - return response || $q.when(response); - }, - 'responseError': function (response) { - $rootScope.spinner.off(); - if (response.config.url.indexOf("acceptError=3Dtrue") =3D=3D= -1) { - var status =3D response.status; - if (status =3D=3D 401) { - console.log("ERROR " + status); - } - if (status =3D=3D 403) { - console.log("UNAUTHORIZED " + status); - } - if (status =3D=3D 400 || status =3D=3D 404 || status =3D= =3D 412 || status =3D=3D 500) { - console.log("GENERIC ERROR " + status); - } - } - return $q.reject(response); - } - }; - }); + //SYNCOPE-780 + $httpProvider.defaults.headers.common["If-Modified-Since"] =3D= "0"; + + $httpProvider.interceptors.push(function ($q, $rootScope, $loc= ation) { + var numLoadings =3D 0; + return { + 'request': function (config, a, b) { + //if the url is an html, we're changing page + if (config.url.indexOf('.html', config.url.length = - 5) =3D=3D -1) { + $rootScope.$broadcast("xhrStarted"); + } + $rootScope.spinner.on(); + return config || $q.when(config); + }, + 'response': function (response) { + //$http.pendingRequests.length + $rootScope.spinner.off(); + return response || $q.when(response); + }, + 'responseError': function (response) { + $rootScope.spinner.off(); + if (response.config.url.indexOf("acceptError=3Dtru= e") =3D=3D -1) { + var status =3D response.status; + if (status =3D=3D 401) { + console.log("ERROR " + status); + } + if (status =3D=3D 403) { + console.log("UNAUTHORIZED " + status); + } + if (status =3D=3D 400 || status =3D=3D 404 || = status =3D=3D 412 || status =3D=3D 500) { + console.log("GENERIC ERROR " + status); + } + } + return $q.reject(response); + } + }; + }); =20 - }]); + }]); =20 -app.run(['$rootScope', '$location', '$cookies', '$state', - function ($rootScope, $location, $cookies, $state) { - // main program - // keep user logged in after page refresh - // check if user is logged or not - $rootScope.currentUser =3D $cookies.get('currentUser') || null; - //If the route change failed due to authentication error, redirect= them out - $rootScope.$on('$routeChangeError', function (event, current, prev= ious, rejection) { - if (rejection =3D=3D=3D 'Not Authenticated') { - $location.path('/self'); - } - }); +app.run(['$rootScope', '$location', '$cookies', '$state', 'AuthService= ', + function ($rootScope, $location, $cookies, $state, AuthService) { + // main program + // keep user logged in after page refresh + //If the route change failed due to authentication error, redi= rect them out + $rootScope.$on('$routeChangeError', function (event, current, = previous, rejection) { + if (rejection =3D=3D=3D 'Not Authenticated') { + $location.path('/self'); + } + }); =20 - $rootScope.$on('$stateChangeSuccess', function (event, toState) { - if (toState.name =3D=3D=3D 'create') { - $state.go('create.credentials'); - } else if (toState.name =3D=3D=3D 'update') { - $state.go('update.credentials'); - } - else { - $state.go(toState); - } - }); + $rootScope.$on('$stateChangeSuccess', function (event, toState= ) { + if (toState.name =3D=3D=3D 'create') { + $state.go('create.credentials'); + =20 + }else if (toState.name =3D=3D=3D 'update') { + $state.go('update.credentials'); + =20 + } else if (toState.name.indexOf("update") > -1) { + AuthService.islogged().then(function (response) { + if (response =3D=3D=3D "true") { + $state.go(toState); + } else { + $state.go('self'); + } + }, function (response) { + console.log("not logged"); + $state.go('self'); + } + ); + + } else if (toState.name =3D=3D=3D 'home' || toState.name = =3D=3D=3D 'self' ) { + AuthService.islogged().then(function (response) { --- End diff -- =20 Also here: rename `AuthService`. > Once authenticated to enduser, "Cancel" brings nowhere=20 > ------------------------------------------------------- > > Key: SYNCOPE-798 > URL: https://issues.apache.org/jira/browse/SYNCOPE-798 > Project: Syncope > Issue Type: Bug > Components: enduser > Affects Versions: 2.0.0-M2 > Reporter: Francesco Chicchiricc=C3=B2 > Assignee: Matteo Di Carlo > Fix For: 2.0.0 > > Attachments: pointless page.png > > > How to reproduce: > # log into enduser > # hit the red button Cancel on the bottom > # you are redirected to an empty page (see screenshot attached) > Cancel should be equivalent to Logout (so it is really needed? The logout= button is already there). > Incidentally, the same pointless page is returned when accessing /syncope= -enduser if authenticated - which looks wrong, the excepted landing page sh= ould be first one, e.g. "crendentials". -- This message was sent by Atlassian JIRA (v6.3.4#6332)