MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / onOk

Method onOk

src/controller/pwd.controller.js:44–66  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

42 }
43
44 async onOk(msg) {
45 try {
46 this.options.password = msg.password;
47 if (msg.cache != prefs.prefs.security.password_cache) {
48 // update pwd cache status
49 await prefs.update({security: {password_cache: msg.cache}});
50 }
51 const key = await pwdCache.unlock(this.options);
52 this.receivedPortMsg = true;
53 this.closePopup();
54 this.passwordRequest.resolve({key, password: this.options.password});
55 } catch (err) {
56 if (err.code == 'WRONG_PASSWORD') {
57 this.ports.pwdDialog.emit('wrong-password');
58 } else {
59 if (this.ports.dDialog) {
60 this.ports.dDialog.emit('error-message', {error: err.message});
61 }
62 this.closePopup();
63 this.passwordRequest.reject(err);
64 }
65 }
66 }
67
68 onCancel() {
69 this.receivedPortMsg = true;

Callers

nothing calls this directly

Calls 5

closePopupMethod · 0.95
updateMethod · 0.80
unlockMethod · 0.80
rejectMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected