This repository was archived by the owner on Dec 24, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,18 @@ angular.module('myApp', [
1313] ) .
1414config ( [ '$routeProvider' , function ( $routeProvider ) {
1515 $routeProvider . otherwise ( { redirectTo : '/view1' } ) ;
16- } ] ) . run ( function ( $rootScope , $modal ) {
16+ } ] ) . run ( function ( $rootScope , $modal , authService , $http ) {
1717
1818 // Call when the 401 response is returned by the server
1919 $rootScope . $on ( 'event:auth-loginRequired' , function ( rejection ) {
20- $modal . open ( { templateUrl : 'relog/relog.html' , controller : 'RelogCtrl' , backdrop : false } ) ;
20+
21+ // first try jsonp
22+ $http . jsonp ( 'backend/login.php?callback=JSON_CALLBACK' ) . then ( function ( resp ) {
23+ authService . loginConfirmed ( resp . data ) ;
24+ } , function ( ) {
25+ // jsonp failed,
26+ $modal . open ( { templateUrl : 'relog/relog.html' , controller : 'RelogCtrl' , backdrop : false } ) ;
27+ } ) ;
2128 } ) ;
2229
2330} ) ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once 'init.inc.php ' ;
4+
5+ phpCAS::handleLogoutRequests ();
6+ if (!phpCAS::checkAuthentication ()) {
7+ header ('HTTP/1.0 401 Unauthorized ' );
8+ echo 'HTTP/1.0 401 Unauthorized ' ;
9+ exit ();
10+ }
11+
12+ $ user = array ('id ' => phpCAS::getUser ());
13+
14+ if (isset ($ _GET ["callback " ])) {
15+ header ('Content-type: application/javascript; charset=UTF-8 ' );
16+ echo $ _GET ["callback " ] . "( " . json_encode ($ user ) . "); " ;
17+ } else {
18+ header ('Content-type: application/json; charset=UTF-8 ' );
19+ echo json_encode ($ user );
20+ }
21+
22+
You can’t perform that action at this time.
0 commit comments