mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 19:55:54 +00:00
Added "Change Seed" button
This commit is contained in:
@@ -862,6 +862,12 @@ const main = async () => {
|
||||
await initialize(client, wallet, appWindow)
|
||||
})
|
||||
|
||||
ipcMain.on('request-seed-change', (event) => {
|
||||
fs.rmSync(path.join(__dirname, WALLET_DIR , 'seed.txt'))
|
||||
fs.rmSync(path.join(__dirname, WALLET_DIR , 'salt.txt'))
|
||||
appWindow.webContents.send('open-seed-dialog')
|
||||
})
|
||||
|
||||
// We have to wait for the application frontend to be ready, otherwise
|
||||
// we might run into a race condition and the open-dialog events
|
||||
// get triggered before the callbacks are attached
|
||||
@@ -896,6 +902,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
onEnterPassword: (password) => {
|
||||
ipcRenderer.send('password-entered', password)
|
||||
},
|
||||
requestSeedChange: () => {
|
||||
ipcRenderer.send('request-seed-change')
|
||||
},
|
||||
// Step 5 code additions - end
|
||||
|
||||
onUpdateLedgerData: (callback) => {
|
||||
@@ -925,7 +934,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
<input type="text" id="password-input" name="password-input" />
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit">Confirm</button>
|
||||
<button type="button">Change Seed</button>
|
||||
<button type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -952,6 +962,7 @@ window.electronAPI.onOpenPasswordDialog((_event) => {
|
||||
const passwordDialog = document.getElementById('password-dialog');
|
||||
const passwordInput = passwordDialog.querySelector('input');
|
||||
const submitButton = passwordDialog.querySelector('button[type="submit"]');
|
||||
const changeSeedButton = passwordDialog.querySelector('button[type="button"]')
|
||||
|
||||
submitButton.addEventListener('click', () => {
|
||||
const password = passwordInput.value;
|
||||
@@ -959,6 +970,11 @@ window.electronAPI.onOpenPasswordDialog((_event) => {
|
||||
passwordDialog.close()
|
||||
});
|
||||
|
||||
changeSeedButton.addEventListener('click', () => {
|
||||
passwordDialog.close()
|
||||
window.electronAPI.requestSeedChange()
|
||||
});
|
||||
|
||||
passwordDialog.showModal()
|
||||
});
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user