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
|
||||
|
||||
// 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) {
|
||||
if (store.rpc) { return void cb(account); }
|
||||
require(['/common/pinpad.js'], function (Pinpad) {
|
||||
|
|
|
@ -23,6 +23,7 @@ define([
|
|||
UPLOAD_COMPLETE: Store.uploadComplete,
|
||||
UPLOAD_STATUS: Store.uploadStatus,
|
||||
UPLOAD_CANCEL: Store.uploadCancel,
|
||||
WRITE_LOGIN_BLOCK: Store.writeLoginBlock,
|
||||
PIN_PADS: Store.pinPads,
|
||||
UNPIN_PADS: Store.unpinPads,
|
||||
GET_DELETED_PADS: Store.getDeletedPads,
|
||||
|
|
|
@ -221,6 +221,10 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
exp.writeLoginBlock = function (data, cb) {
|
||||
cb();
|
||||
};
|
||||
|
||||
cb(e, exp);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -643,6 +643,10 @@ define([
|
|||
Cryptpad.changePadPassword(Cryptget, href, data.password, edPublic, cb);
|
||||
});
|
||||
|
||||
sframeChan.on('Q_WRITE_LOGIN_BLOCK', function (data, cb) {
|
||||
Cryptpad.writeLoginBlock(data, cb);
|
||||
});
|
||||
|
||||
if (cfg.addRpc) {
|
||||
cfg.addRpc(sframeChan, Cryptpad, Utils);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,9 @@ define({
|
|||
// Get the user's pin limit, usage and plan
|
||||
'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.
|
||||
// display a warning
|
||||
'Q_GET_PIN_LIMIT_STATUS': true,
|
||||
|
|
|
@ -48,6 +48,7 @@ define([
|
|||
'cp-settings-resettips',
|
||||
'cp-settings-thumbnails',
|
||||
'cp-settings-userfeedback',
|
||||
'cp-settings-change-password',
|
||||
'cp-settings-delete'
|
||||
],
|
||||
'creation': [
|
||||
|
@ -312,6 +313,7 @@ define([
|
|||
};
|
||||
|
||||
create['delete'] = function () {
|
||||
if (!common.isLoggedIn()) { return; }
|
||||
var $div = $('<div>', { 'class': 'cp-settings-delete cp-sidebarlayout-element'});
|
||||
|
||||
$('<span>', {'class': 'label'}).text(Messages.settings_deleteTitle).appendTo($div);
|
||||
|
@ -368,6 +370,30 @@ define([
|
|||
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
|
||||
|
||||
var setHTML = function (e, html) {
|
||||
|
|
Loading…
Reference in New Issue