diff --git a/app.js b/app.js index bf78b45..b10238f 100644 --- a/app.js +++ b/app.js @@ -30,7 +30,7 @@ app.use(session({ saveUninitialized: true, //添加这行 secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串 cookie: { - maxAge: 3600 * 24 * 30 + maxAge: 3600000 * 24 * 30 } })); diff --git a/public/scripts/controllers/home-controller.js b/public/scripts/controllers/home-controller.js index d611bd1..285c7b0 100644 --- a/public/scripts/controllers/home-controller.js +++ b/public/scripts/controllers/home-controller.js @@ -1,21 +1,46 @@ app.controller('homeCtr', ['$scope', '$stateParams', '$filter', '$state', '$window', 'bookmarkService', 'pubSubService', function($scope, $stateParams, $filter, $state, $window, bookmarkService, pubSubService) { console.log('Hello homeCtr......'); - bookmarkService.autoLogin().then( - function(data) { - console.log(data); - if (data.logined) { - pubSubService.publish('loginCtr.login', { - 'login': data.logined, - }); - $state.go('bookmarks', { - showStyle: 'navigate', - }) - } else { - console.log('login failed......................') + var debug = true; + if (debug) { + bookmarkService.login({ + username: 'luchenqun', + password: 'fendoubuxi', + autoLogin: true, + }).then( + function(data) { + console.log(data); + if (data.logined) { + pubSubService.publish('loginCtr.login', { + 'login': data.logined, + }); + $state.go('bookmarks', { + showStyle: 'navigate', + }) + } else { + console.log('login failed......................') + } + }, + function(errorMsg) { + console.log(errorMsg); } - }, - function(errorMsg) { - console.log(errorMsg); - } - ); + ); + } else { + bookmarkService.autoLogin().then( + function(data) { + if (data.logined || debug) { + pubSubService.publish('loginCtr.login', { + 'login': debug || data.logined, + }); + $state.go('bookmarks', { + showStyle: 'navigate', + }) + } else { + console.log('login failed......................') + } + }, + function(errorMsg) { + console.log(errorMsg); + } + ); + } }]); diff --git a/public/views/bookmarks.html b/public/views/bookmarks.html index 1046c0e..f49b126 100644 --- a/public/views/bookmarks.html +++ b/public/views/bookmarks.html @@ -2,7 +2,7 @@