Closes #216: redirect to login if not connected

This commit is contained in:
Benjamin Gamard 2018-03-23 09:53:18 +01:00
parent cbb8d4e1b6
commit d2256eabfa

View File

@ -5,7 +5,11 @@
*/
angular.module('docs').controller('Main', function($scope, $rootScope, $state, User) {
User.userInfo().then(function(data) {
if (!data.anonymous) {
if (data.anonymous) {
$state.go('login', {}, {
location: 'replace'
});
} else {
$state.go('document.default', {}, {
location: 'replace'
});