This repository was archived by the owner on Dec 24, 2019. It is now read-only.
File tree 2 files changed +31
-2
lines changed
2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,18 @@ angular.module('myApp', [
13
13
] ) .
14
14
config ( [ '$routeProvider' , function ( $routeProvider ) {
15
15
$routeProvider . otherwise ( { redirectTo : '/view1' } ) ;
16
- } ] ) . run ( function ( $rootScope , $modal ) {
16
+ } ] ) . run ( function ( $rootScope , $modal , authService , $http ) {
17
17
18
18
// Call when the 401 response is returned by the server
19
19
$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
+ } ) ;
21
28
} ) ;
22
29
23
30
} ) ;
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