mirror of https://github.com/xwiki-labs/cryptpad
Change account password (clientside RPC)
This commit is contained in:
parent
b89b033175
commit
d37aa0646e
|
@ -234,6 +234,12 @@ define([
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
common.writeLoginBlock = function (data, cb) {
|
||||||
|
postMessage('WRITE_LOGIN_BLOCK', data, function (obj) {
|
||||||
|
cb(obj);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// ANON RPC
|
// ANON RPC
|
||||||
|
|
||||||
// SFRAME: talk to anon_rpc from the iframe
|
// SFRAME: talk to anon_rpc from the iframe
|
||||||
|
|
|
@ -276,6 +276,15 @@ define([
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Store.writeLoginBlock = function (clientId, data, cb) {
|
||||||
|
store.rpc.writeLoginBlock(data, function (e, res) {
|
||||||
|
cb({
|
||||||
|
error: e,
|
||||||
|
data: res
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Store.initRpc = function (clientId, data, cb) {
|
Store.initRpc = function (clientId, data, cb) {
|
||||||
if (store.rpc) { return void cb(account); }
|
if (store.rpc) { return void cb(account); }
|
||||||
require(['/common/pinpad.js'], function (Pinpad) {
|
require(['/common/pinpad.js'], function (Pinpad) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ define([
|
||||||
UPLOAD_COMPLETE: Store.uploadComplete,
|
UPLOAD_COMPLETE: Store.uploadComplete,
|
||||||
UPLOAD_STATUS: Store.uploadStatus,
|
UPLOAD_STATUS: Store.uploadStatus,
|
||||||
UPLOAD_CANCEL: Store.uploadCancel,
|
UPLOAD_CANCEL: Store.uploadCancel,
|
||||||
|
WRITE_LOGIN_BLOCK: Store.writeLoginBlock,
|
||||||
PIN_PADS: Store.pinPads,
|
PIN_PADS: Store.pinPads,
|
||||||
UNPIN_PADS: Store.unpinPads,
|
UNPIN_PADS: Store.unpinPads,
|
||||||
GET_DELETED_PADS: Store.getDeletedPads,
|
GET_DELETED_PADS: Store.getDeletedPads,
|
||||||
|
|
|
@ -221,6 +221,10 @@ define([
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exp.writeLoginBlock = function (data, cb) {
|
||||||
|
cb();
|
||||||
|
};
|
||||||
|
|
||||||
cb(e, exp);
|
cb(e, exp);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -643,6 +643,10 @@ define([
|
||||||
Cryptpad.changePadPassword(Cryptget, href, data.password, edPublic, cb);
|
Cryptpad.changePadPassword(Cryptget, href, data.password, edPublic, cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sframeChan.on('Q_WRITE_LOGIN_BLOCK', function (data, cb) {
|
||||||
|
Cryptpad.writeLoginBlock(data, cb);
|
||||||
|
});
|
||||||
|
|
||||||
if (cfg.addRpc) {
|
if (cfg.addRpc) {
|
||||||
cfg.addRpc(sframeChan, Cryptpad, Utils);
|
cfg.addRpc(sframeChan, Cryptpad, Utils);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,9 @@ define({
|
||||||
// Get the user's pin limit, usage and plan
|
// Get the user's pin limit, usage and plan
|
||||||
'Q_PIN_GET_USAGE': true,
|
'Q_PIN_GET_USAGE': true,
|
||||||
|
|
||||||
|
// Write/update the login block when the account password is changed
|
||||||
|
'Q_WRITE_LOGIN_BLOCK': true,
|
||||||
|
|
||||||
// Check the pin limit to determine if we can store the pad in the drive or if we should.
|
// Check the pin limit to determine if we can store the pad in the drive or if we should.
|
||||||
// display a warning
|
// display a warning
|
||||||
'Q_GET_PIN_LIMIT_STATUS': true,
|
'Q_GET_PIN_LIMIT_STATUS': true,
|
||||||
|
|
|
@ -48,6 +48,7 @@ define([
|
||||||
'cp-settings-resettips',
|
'cp-settings-resettips',
|
||||||
'cp-settings-thumbnails',
|
'cp-settings-thumbnails',
|
||||||
'cp-settings-userfeedback',
|
'cp-settings-userfeedback',
|
||||||
|
'cp-settings-change-password',
|
||||||
'cp-settings-delete'
|
'cp-settings-delete'
|
||||||
],
|
],
|
||||||
'creation': [
|
'creation': [
|
||||||
|
@ -312,6 +313,7 @@ define([
|
||||||
};
|
};
|
||||||
|
|
||||||
create['delete'] = function () {
|
create['delete'] = function () {
|
||||||
|
if (!common.isLoggedIn()) { return; }
|
||||||
var $div = $('<div>', { 'class': 'cp-settings-delete cp-sidebarlayout-element'});
|
var $div = $('<div>', { 'class': 'cp-settings-delete cp-sidebarlayout-element'});
|
||||||
|
|
||||||
$('<span>', {'class': 'label'}).text(Messages.settings_deleteTitle).appendTo($div);
|
$('<span>', {'class': 'label'}).text(Messages.settings_deleteTitle).appendTo($div);
|
||||||
|
@ -368,6 +370,30 @@ define([
|
||||||
return $div;
|
return $div;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
create['change-password'] = function () {
|
||||||
|
if (!common.isLoggedIn()) { return; }
|
||||||
|
|
||||||
|
var $div = $('<div>', { 'class': 'cp-settings-change-password cp-sidebarlayout-element'});
|
||||||
|
|
||||||
|
$('<span>', {'class': 'label'}).text("TODO Change your password").appendTo($div); // XXX
|
||||||
|
|
||||||
|
$('<span>', {'class': 'cp-sidebarlayout-description'})
|
||||||
|
.append("TODO").appendTo($div); // XXX
|
||||||
|
|
||||||
|
// var publicKey = privateData.edPublic;
|
||||||
|
|
||||||
|
var updateBlock = function (data, cb) {
|
||||||
|
sframeChan.query('Q_WRITE_LOGIN_BLOCK', data, function (err, obj) {
|
||||||
|
if (err || obj.error) { return void cb ({error: err || obj.error}); }
|
||||||
|
cb (obj);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
updateBlock = updateBlock; // jshint..
|
||||||
|
|
||||||
|
return $div;
|
||||||
|
};
|
||||||
|
|
||||||
// Pad Creation settings
|
// Pad Creation settings
|
||||||
|
|
||||||
var setHTML = function (e, html) {
|
var setHTML = function (e, html) {
|
||||||
|
|
Loading…
Reference in New Issue