forked from OpenDSU/demiurge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PharmaLedger-IMI/epi-workspace#906 my-identities: you can copy your r…
…ecovery code; new account: you can paste a recovery code instead of waiting for access from an administrator
- Loading branch information
1 parent
0be087f
commit 40de554
Showing
8 changed files
with
190 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 25 additions & 11 deletions
36
code/components/dw-dialog-waiting-approval/dw-dialog-waiting-approval.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
<link rel="stylesheet" href="components/dw-dialog-waiting-approval/dw-dialog-waiting-approval.css"> | ||
<sl-dialog class="dw-dialog dw-dialog-waiting-approval" no-header> | ||
<header> | ||
<h3> | ||
<sl-icon name="person-bounding-box"></sl-icon> | ||
Waiting for administrator to grant access | ||
</h3> | ||
<sl-icon-button name="x-lg" close></sl-icon-button> | ||
</header> | ||
|
||
<sl-dialog class="dw-dialog dw-dialog-waiting-approval" no-header> | ||
<main> | ||
<h4>Copy this DID and give it to the right administrator.</h4> | ||
<dw-clipboard-input value="@did" readonly></dw-clipboard-input> | ||
<div id="did-div"> | ||
<h3> | ||
<sl-icon name="person-bounding-box"></sl-icon> | ||
Waiting for administrator to grant access | ||
</h3> | ||
<br> | ||
<h4>Copy this DID and give it to the right administrator.</h4> | ||
<dw-clipboard-input value="@did" readonly></dw-clipboard-input> | ||
</div> | ||
<webc-container controller="DwDialogWaitingApprovalController" id="recovery-code-div"> | ||
<h3> | ||
<sl-icon name="clipboard-check"></sl-icon> | ||
Or go ahead and | ||
</h3> | ||
<br> | ||
<h4>Paste your recovery code here to gain access.</h4> | ||
<sl-input name="recovery-code" placeholder="recovery code" id="add-member-input" type="password" required clearable> | ||
<sl-button slot="suffix" type="text" data-tag="paste-from-clipboard" class="dw-paste"> | ||
Paste | ||
</sl-button> | ||
<sl-icon slot="suffix" name="arrow-right-short" data-tag="continue"></sl-icon> | ||
</sl-input> | ||
</webc-container> | ||
</main> | ||
</sl-dialog> | ||
</sl-dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
code/scripts/controllers/DwDialogWaitingApprovalController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const {DwController} = WebCardinal.controllers; | ||
|
||
export default class DwDialogWaitingApprovalController extends DwController { | ||
constructor(...props) { | ||
super(...props); | ||
|
||
this.tagClickListeners(); | ||
} | ||
|
||
tagClickListeners() { | ||
this.onTagClick("paste-from-clipboard", () => { | ||
navigator.clipboard.readText() | ||
.then((clipText) => (document.getElementById("add-member-input").value = clipText)) | ||
.catch(err => console.log(err)); | ||
}); | ||
this.onTagClick("continue", async () => { | ||
if (document.getElementById("add-member-input").value === "") { | ||
return; | ||
} | ||
this.setSharedEnclaveKeySSI().then().catch(err => { | ||
console.log(err); | ||
}); | ||
|
||
this.ui.enableMenu(); | ||
this.navigateToPageTag("quick-actions"); | ||
}); | ||
} | ||
|
||
async setSharedEnclaveKeySSI() { | ||
const openDSU = require("opendsu"); | ||
const scAPI = openDSU.loadAPI("sc"); | ||
const enclaveAPI = openDSU.loadAPI("enclave"); | ||
const recoveryCode = document.getElementById("add-member-input").value; | ||
|
||
const sharedEnclave = enclaveAPI.initialiseWalletDBEnclave(recoveryCode); | ||
sharedEnclave.on("initialised", async () => { | ||
try { | ||
await $$.promisify(scAPI.setSharedEnclave)(sharedEnclave); | ||
} catch (e) { | ||
throw ("Failed to set shared enclave " + e); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters