Fix/incorrect password error not showing on login screen
This commit is contained in:
committed by
Sofiya Tepikin
parent
aa0e5b6836
commit
dd18611498
@@ -82,7 +82,7 @@ export default class PasswordPrompt extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { password } = this.state
|
const { password } = this.state
|
||||||
const isPasswordEntered = password && password.length > 0
|
const isPasswordEntered = Boolean(password)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -95,6 +95,9 @@ export default class PasswordPrompt extends Component {
|
|||||||
placeholder={labels.enterPassword}
|
placeholder={labels.enterPassword}
|
||||||
/>
|
/>
|
||||||
<View style={styles.containerButtons}>
|
<View style={styles.containerButtons}>
|
||||||
|
<Button onPress={this.onConfirmDeletion}>
|
||||||
|
{labels.forgotPassword}
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={!isPasswordEntered}
|
disabled={!isPasswordEntered}
|
||||||
isCTA={isPasswordEntered}
|
isCTA={isPasswordEntered}
|
||||||
@@ -102,9 +105,6 @@ export default class PasswordPrompt extends Component {
|
|||||||
>
|
>
|
||||||
{labels.title}
|
{labels.title}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onPress={this.onConfirmDeletion}>
|
|
||||||
{labels.forgotPassword}
|
|
||||||
</Button>
|
|
||||||
</View>
|
</View>
|
||||||
</AppPage>
|
</AppPage>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
@@ -122,4 +122,4 @@ const styles = StyleSheet.create({
|
|||||||
...Containers.rowContainer,
|
...Containers.rowContainer,
|
||||||
justifyContent: 'space-around'
|
justifyContent: 'space-around'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+6
-4
@@ -23,10 +23,12 @@ export async function openDb (hash) {
|
|||||||
try {
|
try {
|
||||||
tempConnection = await Realm.open(realmConfig)
|
tempConnection = await Realm.open(realmConfig)
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
// wrong password provided
|
const isErrorDecrypting = err.toString().includes('decrypt')
|
||||||
if (hash && err.toString().includes('decrypt')) return false
|
const isErrorMnemonic = err.toString().includes('Invalid mnemonic')
|
||||||
// tried to open without password, but is encrypted
|
// tried to open without password, but is encrypted or incorrect pwd
|
||||||
if (!hash && err.toString().includes('Invalid mnemonic')) return false
|
if (isErrorMnemonic) return false
|
||||||
|
// cannot decrypt db with given pwd
|
||||||
|
if (hash && isErrorDecrypting) return false
|
||||||
|
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user