mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 15:41:19 +00:00
注销账户
This commit is contained in:
7
node_modules/api.js
generated
vendored
7
node_modules/api.js
generated
vendored
@@ -114,8 +114,11 @@ var Api = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
logout: function (callback) {
|
||||||
|
needle.post(this.getUrl('auth/logout'), {timeout: 10000}, function(error, response) {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getSyncNotebooks: function(afterUsn, maxEntry, callback) {
|
getSyncNotebooks: function(afterUsn, maxEntry, callback) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
2
node_modules/file.js
generated
vendored
2
node_modules/file.js
generated
vendored
@@ -11,7 +11,7 @@ var Attachs = db.attachs;
|
|||||||
var Web = require('web');
|
var Web = require('web');
|
||||||
|
|
||||||
function log(o) {
|
function log(o) {
|
||||||
console.log(o);
|
console.trace(o);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
type File struct {
|
type File struct {
|
||||||
|
16
node_modules/user.js
generated
vendored
16
node_modules/user.js
generated
vendored
@@ -48,6 +48,22 @@ User = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 注销
|
||||||
|
logout: function (callback) {
|
||||||
|
var me = this;
|
||||||
|
db.users.update({_id: me.userId}, {$set:{IsActive: false}}, function () {
|
||||||
|
if (me.isLocal()) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
if(!Api) {
|
||||||
|
Api = require('api');
|
||||||
|
}
|
||||||
|
Api.logout(function() {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
login: function(username, password, host, callback) {
|
login: function(username, password, host, callback) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@@ -2010,6 +2010,20 @@ function userMenu(allUsers) {
|
|||||||
click: function(e) {
|
click: function(e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 注销
|
||||||
|
this.logout = new gui.MenuItem({
|
||||||
|
label: getMsg('Logout'),
|
||||||
|
click: function(e) {
|
||||||
|
Loading.show();
|
||||||
|
onClose(function () {
|
||||||
|
UserService.logout(function () {
|
||||||
|
toLogin();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.switchAccount = new gui.MenuItem({
|
this.switchAccount = new gui.MenuItem({
|
||||||
label: getMsg('Add account'),
|
label: getMsg('Add account'),
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
@@ -2036,7 +2050,6 @@ function userMenu(allUsers) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.menu.append(this.email);
|
this.menu.append(this.email);
|
||||||
if (!UserInfo.IsLocal) {//hide sync menu for local account
|
if (!UserInfo.IsLocal) {//hide sync menu for local account
|
||||||
this.blog = new gui.MenuItem({
|
this.blog = new gui.MenuItem({
|
||||||
@@ -2048,6 +2061,7 @@ function userMenu(allUsers) {
|
|||||||
this.menu.append(this.blog);
|
this.menu.append(this.blog);
|
||||||
}
|
}
|
||||||
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||||
|
this.menu.append(this.logout);
|
||||||
this.menu.append(this.switchAccount);
|
this.menu.append(this.switchAccount);
|
||||||
this.menu.append(allUsersMenu);
|
this.menu.append(allUsersMenu);
|
||||||
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||||
@@ -2058,9 +2072,9 @@ function userMenu(allUsers) {
|
|||||||
this.menu.append(themeMenu);
|
this.menu.append(themeMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
var height = 230;
|
var height = 260;
|
||||||
if (UserInfo.IsLocal) {
|
if (UserInfo.IsLocal) {
|
||||||
height = 200;
|
height = 230;
|
||||||
}
|
}
|
||||||
if(!isMac()) {
|
if(!isMac()) {
|
||||||
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||||
|
@@ -1503,7 +1503,7 @@ function goToMainPage() {
|
|||||||
win.loadUrl('file://' + __dirname + '/note.html?from=login');
|
win.loadUrl('file://' + __dirname + '/note.html?from=login');
|
||||||
}
|
}
|
||||||
|
|
||||||
function _switchAccount() {
|
function toLogin() {
|
||||||
var BrowserWindow = gui.remote.require('browser-window');
|
var BrowserWindow = gui.remote.require('browser-window');
|
||||||
if(isMac()) {
|
if(isMac()) {
|
||||||
var win = new BrowserWindow({ width: 278, height: 326, show: true, frame: false, resizable: false });
|
var win = new BrowserWindow({ width: 278, height: 326, show: true, frame: false, resizable: false });
|
||||||
@@ -1517,14 +1517,14 @@ function _switchAccount() {
|
|||||||
// 添加用户
|
// 添加用户
|
||||||
function switchAccount() {
|
function switchAccount() {
|
||||||
onClose(function () {
|
onClose(function () {
|
||||||
_switchAccount();
|
toLogin();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当没有用户时, 切换之
|
// 当没有用户时, 切换之
|
||||||
function switchToLoginWhenNoUser() {
|
function switchToLoginWhenNoUser() {
|
||||||
Server.close(function () {
|
Server.close(function () {
|
||||||
_switchAccount();
|
toLogin();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,6 +88,7 @@
|
|||||||
"loginSuccess": "登录成功, 正在跳转",
|
"loginSuccess": "登录成功, 正在跳转",
|
||||||
"logining": "正在登录",
|
"logining": "正在登录",
|
||||||
"logout": "退出",
|
"logout": "退出",
|
||||||
|
"Logout": "注销",
|
||||||
"minLength": "长度至少为%s",
|
"minLength": "长度至少为%s",
|
||||||
"Move": "移动",
|
"Move": "移动",
|
||||||
"myBlog": "我的博客",
|
"myBlog": "我的博客",
|
||||||
|
@@ -88,6 +88,7 @@
|
|||||||
"loginSuccess": "登錄成功, 正在跳轉",
|
"loginSuccess": "登錄成功, 正在跳轉",
|
||||||
"logining": "正在登錄",
|
"logining": "正在登錄",
|
||||||
"logout": "退出",
|
"logout": "退出",
|
||||||
|
"Logout": "註銷",
|
||||||
"minLength": "長度至少為%s",
|
"minLength": "長度至少為%s",
|
||||||
"Move": "移動",
|
"Move": "移動",
|
||||||
"myBlog": "我的博客",
|
"myBlog": "我的博客",
|
||||||
|
Reference in New Issue
Block a user