mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Example haveibeenpwned integration
This commit is contained in:
parent
027ce6ccae
commit
c9d3f3de4a
2 changed files with 110 additions and 0 deletions
25
plugins/haveibeenpwned/hibp.js
Normal file
25
plugins/haveibeenpwned/hibp.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(doc => {
|
||||
|
||||
addEventListener('rl-view-model.create', event => {
|
||||
if ('SettingsSecurity' === event.detail.viewModelTemplateID) {
|
||||
const template = doc.getElementById('SettingsSecurity'),
|
||||
details = doc.createElement('details'),
|
||||
summary = doc.createElement('summary'),
|
||||
button = doc.createElement('button');
|
||||
summary.textContent = "Have i been pwned?"
|
||||
button.dataset.bind = "click:HibpCheck";
|
||||
button.textContent = "Check";
|
||||
details.append(summary, button);
|
||||
template.content.append(details);
|
||||
|
||||
event.detail.HibpCheck = () => {
|
||||
// JsonHibpCheck
|
||||
rl.pluginRemoteRequest((iError, oData) => {
|
||||
console.dir({iError, oData});
|
||||
}, 'HibpCheck');
|
||||
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
})(document);
|
||||
Loading…
Add table
Add a link
Reference in a new issue