mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 11:23:48 +01:00
Closes #216: redirect to login if not connected
This commit is contained in:
parent
785ad7f3a1
commit
cbb8d4e1b6
@ -23,7 +23,8 @@ angular.module('docs',
|
||||
url: '',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/docs/main.html'
|
||||
templateUrl: 'partial/docs/main.html',
|
||||
controller: 'Main'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
14
docs-web/src/main/webapp/src/app/docs/controller/Main.js
Normal file
14
docs-web/src/main/webapp/src/app/docs/controller/Main.js
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Main controller.
|
||||
*/
|
||||
angular.module('docs').controller('Main', function($scope, $rootScope, $state, User) {
|
||||
User.userInfo().then(function(data) {
|
||||
if (!data.anonymous) {
|
||||
$state.go('document.default', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@ -10,10 +10,6 @@ angular.module('docs').controller('Navigation', function($scope, $state, $rootSc
|
||||
$state.go('login', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
} else {
|
||||
$state.go('document.default', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
<script src="lib/angular.timeago.js" type="text/javascript"></script>
|
||||
<script src="app/docs/app.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Login.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Main.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/ModalPasswordLost.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/ModalFeedback.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/ModalImport.js" type="text/javascript"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user