diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 1e06653f3..b3f3edb63 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -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 diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 03dfbd64c..e703b6a5b 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -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) { diff --git a/www/common/outer/store-rpc.js b/www/common/outer/store-rpc.js index 5abd3ec8e..a2b7d2404 100644 --- a/www/common/outer/store-rpc.js +++ b/www/common/outer/store-rpc.js @@ -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, diff --git a/www/common/pinpad.js b/www/common/pinpad.js index 957f5d1d6..1e4dd6046 100644 --- a/www/common/pinpad.js +++ b/www/common/pinpad.js @@ -221,6 +221,10 @@ define([ }); }; + exp.writeLoginBlock = function (data, cb) { + cb(); + }; + cb(e, exp); }); }; diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 785ecf299..79f9c45a7 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -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); } diff --git a/www/common/sframe-protocol.js b/www/common/sframe-protocol.js index 6293cf3d8..a75936af5 100644 --- a/www/common/sframe-protocol.js +++ b/www/common/sframe-protocol.js @@ -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, diff --git a/www/settings/inner.js b/www/settings/inner.js index bb5fc3319..acfa8bafd 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -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 = $('