remove ui-router dependancy
This commit is contained in:
@@ -13,6 +13,4 @@ if(!IEOrEdge && (window.crypto && window.crypto.subtle)) {
|
||||
Neeto.crypto = new SNCryptoJS();
|
||||
}
|
||||
|
||||
angular.module('app.frontend', [
|
||||
'ui.router'
|
||||
])
|
||||
angular.module('app.frontend', [])
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
angular.module('app.frontend')
|
||||
.controller('HomeCtrl', function ($scope, $stateParams, $rootScope, $timeout, modelManager, syncManager, authManager) {
|
||||
.controller('HomeCtrl', function ($scope, $location, $rootScope, $timeout, modelManager, syncManager, authManager) {
|
||||
|
||||
function urlParam(key) {
|
||||
return $location.search()[key];
|
||||
}
|
||||
|
||||
function autoSignInFromParams() {
|
||||
var server = urlParam("server");
|
||||
var email = urlParam("email");
|
||||
var pw = urlParam("pw");
|
||||
|
||||
if(!authManager.offline()) {
|
||||
// check if current account
|
||||
if(syncManager.serverURL == $stateParams.server && authManager.user.email == $stateParams.email) {
|
||||
if(syncManager.serverURL === server && authManager.user.email === email) {
|
||||
// already signed in, return
|
||||
return;
|
||||
} else {
|
||||
@@ -14,13 +22,13 @@ angular.module('app.frontend')
|
||||
})
|
||||
}
|
||||
} else {
|
||||
authManager.login($stateParams.server, $stateParams.email, $stateParams.pw, function(response){
|
||||
authManager.login(server, email, pw, function(response){
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if($stateParams.server && $stateParams.email) {
|
||||
if(urlParam("server")) {
|
||||
autoSignInFromParams();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +1,16 @@
|
||||
angular.module('app.frontend')
|
||||
.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
|
||||
.config(function ($locationProvider) {
|
||||
|
||||
$stateProvider
|
||||
.state('base', {
|
||||
abstract: true,
|
||||
})
|
||||
|
||||
.state('home', {
|
||||
url: '/?server&email&pw',
|
||||
parent: 'base',
|
||||
views: {
|
||||
'content@' : {
|
||||
templateUrl: 'frontend/home.html',
|
||||
controller: 'HomeCtrl'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Default fall back route
|
||||
$urlRouterProvider.otherwise(function($injector, $location){
|
||||
var state = $injector.get('$state');
|
||||
state.go('home');
|
||||
return $location.path();
|
||||
});
|
||||
|
||||
var runningInElectron = window && window.process && window.process.type && window.process.versions["electron"];
|
||||
if(!runningInElectron) {
|
||||
if (window.history && window.history.pushState) {
|
||||
$locationProvider.html5Mode({
|
||||
enabled: true,
|
||||
requireBase: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$locationProvider.html5Mode(false);
|
||||
var runningInElectron = window && window.process && window.process.type && window.process.versions["electron"];
|
||||
if(!runningInElectron) {
|
||||
if (window.history && window.history.pushState) {
|
||||
$locationProvider.html5Mode({
|
||||
enabled: true,
|
||||
requireBase: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$locationProvider.html5Mode(false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div ui-view="content"></div>
|
||||
<div ng-controller="HomeCtrl" ng-include="'frontend/home.html'"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user