-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #687 from Keith-CY/verify-mnemonic
feat(neuron-ui): validate mnemonic words before setting password
- Loading branch information
Showing
6 changed files
with
60 additions
and
10 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
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,32 @@ | ||
export const validateMnemonic = (mnemonic: string): boolean => { | ||
if (!window.remote) { | ||
console.warn('remote is not supported') | ||
return true | ||
} | ||
const { validateMnemonic: remoteValidateMnemonic } = window.remote.require('./models/keys/mnemonic') | ||
return remoteValidateMnemonic(mnemonic) | ||
} | ||
|
||
export const showMessage = (options: any, callback: Function) => { | ||
if (!window.remote) { | ||
console.warn('remote is not supported') | ||
window.alert(options.message) | ||
} else { | ||
window.remote.require('electron').dialog.showMessageBox(options, callback) | ||
} | ||
} | ||
|
||
export const showErrorMessage = (title: string, content: string) => { | ||
if (!window.remote) { | ||
console.warn('remote is not supported') | ||
window.alert(`${title}: ${content}`) | ||
} else { | ||
window.remote.require('electron').dialog.showErrorBox(title, content) | ||
} | ||
} | ||
|
||
export default { | ||
validateMnemonic, | ||
showMessage, | ||
showErrorMessage, | ||
} |
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