diff --git a/components/password-prompt.js b/components/password-prompt.js index 4190312..4f2544c 100644 --- a/components/password-prompt.js +++ b/components/password-prompt.js @@ -82,7 +82,7 @@ export default class PasswordPrompt extends Component { render() { const { password } = this.state - const isPasswordEntered = password && password.length > 0 + const isPasswordEntered = Boolean(password) return ( @@ -95,6 +95,9 @@ export default class PasswordPrompt extends Component { placeholder={labels.enterPassword} /> + - @@ -122,4 +122,4 @@ const styles = StyleSheet.create({ ...Containers.rowContainer, justifyContent: 'space-around' } -}) \ No newline at end of file +}) diff --git a/db/index.js b/db/index.js index 16f584e..f1ab4a4 100644 --- a/db/index.js +++ b/db/index.js @@ -23,10 +23,12 @@ export async function openDb (hash) { try { tempConnection = await Realm.open(realmConfig) } catch(err) { - // wrong password provided - if (hash && err.toString().includes('decrypt')) return false - // tried to open without password, but is encrypted - if (!hash && err.toString().includes('Invalid mnemonic')) return false + const isErrorDecrypting = err.toString().includes('decrypt') + const isErrorMnemonic = err.toString().includes('Invalid mnemonic') + // tried to open without password, but is encrypted or incorrect pwd + if (isErrorMnemonic) return false + // cannot decrypt db with given pwd + if (hash && isErrorDecrypting) return false throw err }