mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-04 11:55:50 +00:00
Added "Change Seed" button
This commit is contained in:
@@ -56,6 +56,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
|
||||
|
||||
@@ -57,7 +57,13 @@ const main = async () => {
|
||||
|
||||
})
|
||||
|
||||
// We have to wait for the application frontend to be ready, otherise
|
||||
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 ope-dialog events
|
||||
// get triggered before the callbacks are attached
|
||||
appWindow.once('ready-to-show', () => {
|
||||
|
||||
@@ -64,7 +64,13 @@ const main = async () => {
|
||||
|
||||
})
|
||||
|
||||
// We have to wait for the application frontend to be ready, otherise
|
||||
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 ope-dialog events
|
||||
// get triggered before the callbacks are attached
|
||||
appWindow.once('ready-to-show', () => {
|
||||
|
||||
@@ -71,7 +71,13 @@ const main = async () => {
|
||||
|
||||
})
|
||||
|
||||
// We have to wait for the application frontend to be ready, otherise
|
||||
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 ope-dialog events
|
||||
// get triggered before the callbacks are attached
|
||||
appWindow.once('ready-to-show', () => {
|
||||
|
||||
@@ -58,10 +58,11 @@
|
||||
<dialog id="password-dialog">
|
||||
<form method="dialog">
|
||||
<div>
|
||||
<label for="password-input">Enter password (min-length 5):</label>
|
||||
<label for="password-input">Enter password (min-length 5):</label><br />
|
||||
<input type="text" id="password-input" name="password-input" />
|
||||
</div>
|
||||
<div>
|
||||
<button type="button">Change Seed</button>
|
||||
<button type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -14,6 +14,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
onEnterPassword: (password) => {
|
||||
ipcRenderer.send('password-entered', password)
|
||||
},
|
||||
requestSeedChange: () => {
|
||||
ipcRenderer.send('request-seed-change')
|
||||
},
|
||||
// Step 5 code additions - end
|
||||
|
||||
onUpdateLedgerData: (callback) => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Step 5 code additions - start
|
||||
window.electronAPI.onOpenSeedDialog((_event) => {
|
||||
const seedDialog = document.getElementById('seed-dialog');
|
||||
const seedInput = seedDialog.querySelector('input');
|
||||
const submitButton = seedDialog.querySelector('button[type="submit"]');
|
||||
const seedDialog = document.getElementById('seed-dialog')
|
||||
const seedInput = seedDialog.querySelector('input')
|
||||
const submitButton = seedDialog.querySelector('button[type="submit"]')
|
||||
|
||||
submitButton.addEventListener('click', () => {
|
||||
const seed = seedInput.value;
|
||||
const seed = seedInput.value
|
||||
window.electronAPI.onEnterSeed(seed)
|
||||
seedDialog.close()
|
||||
});
|
||||
@@ -14,16 +14,22 @@ window.electronAPI.onOpenSeedDialog((_event) => {
|
||||
})
|
||||
|
||||
window.electronAPI.onOpenPasswordDialog((_event) => {
|
||||
const passwordDialog = document.getElementById('password-dialog');
|
||||
const passwordInput = passwordDialog.querySelector('input');
|
||||
const submitButton = passwordDialog.querySelector('button[type="submit"]');
|
||||
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;
|
||||
const password = passwordInput.value
|
||||
window.electronAPI.onEnterPassword(password)
|
||||
passwordDialog.close()
|
||||
});
|
||||
|
||||
changeSeedButton.addEventListener('click', () => {
|
||||
passwordDialog.close()
|
||||
window.electronAPI.requestSeedChange()
|
||||
});
|
||||
|
||||
passwordDialog.showModal()
|
||||
});
|
||||
// Step 5 code additions - end
|
||||
|
||||
@@ -102,10 +102,11 @@
|
||||
<dialog id="password-dialog">
|
||||
<form method="dialog">
|
||||
<div>
|
||||
<label for="password-input">Enter password (min-length: 5):</label>
|
||||
<label for="password-input">Enter password (min-length 5):</label><br />
|
||||
<input type="text" id="password-input" name="password-input" />
|
||||
</div>
|
||||
<div>
|
||||
<button type="button">Change Seed</button>
|
||||
<button type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -13,6 +13,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
onEnterPassword: (password) => {
|
||||
ipcRenderer.send('password-entered', password)
|
||||
},
|
||||
requestSeedChange: () => {
|
||||
ipcRenderer.send('request-seed-change')
|
||||
},
|
||||
onUpdateLedgerData: (callback) => {
|
||||
ipcRenderer.on('update-ledger-data', callback)
|
||||
},
|
||||
|
||||
@@ -13,16 +13,22 @@ window.electronAPI.onOpenSeedDialog((_event) => {
|
||||
})
|
||||
|
||||
window.electronAPI.onOpenPasswordDialog((_event) => {
|
||||
const passwordDialog = document.getElementById('password-dialog');
|
||||
const passwordInput = passwordDialog.querySelector('input');
|
||||
const submitButton = passwordDialog.querySelector('button[type="submit"]');
|
||||
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;
|
||||
const password = passwordInput.value
|
||||
window.electronAPI.onEnterPassword(password)
|
||||
passwordDialog.close()
|
||||
});
|
||||
|
||||
changeSeedButton.addEventListener('click', () => {
|
||||
passwordDialog.close()
|
||||
window.electronAPI.requestSeedChange()
|
||||
});
|
||||
|
||||
passwordDialog.showModal()
|
||||
});
|
||||
|
||||
|
||||
@@ -138,11 +138,12 @@
|
||||
<dialog id="password-dialog">
|
||||
<form method="dialog">
|
||||
<div>
|
||||
<label for="password-input">Enter password (min-length: 5):</label>
|
||||
<label for="password-input">Enter password (min-length 5):</label><br />
|
||||
<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>
|
||||
|
||||
@@ -141,11 +141,12 @@
|
||||
<dialog id="password-dialog">
|
||||
<form method="dialog">
|
||||
<div>
|
||||
<label for="password-input">Enter password (min-length: 5):</label>
|
||||
<label for="password-input">Enter password (min-length 5):</label><br />
|
||||
<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>
|
||||
|
||||
@@ -13,6 +13,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
onEnterPassword: (password) => {
|
||||
ipcRenderer.send('password-entered', password)
|
||||
},
|
||||
requestSeedChange: () => {
|
||||
ipcRenderer.send('request-seed-change')
|
||||
},
|
||||
onUpdateLedgerData: (callback) => {
|
||||
ipcRenderer.on('update-ledger-data', callback)
|
||||
},
|
||||
|
||||
@@ -13,16 +13,22 @@ window.electronAPI.onOpenSeedDialog((_event) => {
|
||||
})
|
||||
|
||||
window.electronAPI.onOpenPasswordDialog((_event) => {
|
||||
const passwordDialog = document.getElementById('password-dialog');
|
||||
const passwordInput = passwordDialog.querySelector('input');
|
||||
const submitButton = passwordDialog.querySelector('button[type="submit"]');
|
||||
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;
|
||||
const password = passwordInput.value
|
||||
window.electronAPI.onEnterPassword(password)
|
||||
passwordDialog.close()
|
||||
});
|
||||
|
||||
changeSeedButton.addEventListener('click', () => {
|
||||
passwordDialog.close()
|
||||
window.electronAPI.requestSeedChange()
|
||||
});
|
||||
|
||||
passwordDialog.showModal()
|
||||
});
|
||||
|
||||
|
||||
@@ -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