Nav re-order. Profile page
[osm/UI.git] / skyquake / framework / core / modules / routes / navigation.js
index 9b8fbf7..bf9c47b 100644 (file)
@@ -44,12 +44,12 @@ Router.get('/login.html', cors(), function(req, res) {
 
 Router.get('/', cors(), function(req, res) {
        var api_server = req.query['api_server'] || (req.protocol + '://' + configurationAPI.globalConfiguration.get().api_server);
-       if (req.session.loggedIn) {
+       if (req.session && req.session.loggedIn) {
                console.log('Logged in. Redirect to launchpad')
                res.redirect('/launchpad/?api_server=' + api_server + '&upload_server=' + req.protocol + '://' + (configurationAPI.globalConfiguration.get().upload_server || req.hostname));
        } else {
                console.log('Redirect to login.html');
-               res.redirect('login.html?api_server=' + api_server);
+               res.redirect('login.html?api_server=' + api_server + '&upload_server=' + req.protocol + '://' + (configurationAPI.globalConfiguration.get().upload_server || req.hostname));
        }
 });