Merge branch '242-password-not-working' into 'master'

Resolve "password not working"

Closes #242

See merge request bloodyhealth/drip!102
This commit is contained in:
Julia Friesel
2018-11-04 09:57:45 +00:00
3 changed files with 36 additions and 27 deletions
@@ -3,21 +3,18 @@ import { openDb } from '../../../db'
import { shared } from '../../labels'
export default async function checkPassword({hash, onCancel, onTryAgain }) {
try {
await openDb({ hash, persistConnection: false })
return true
} catch (err) {
Alert.alert(
shared.incorrectPassword,
shared.incorrectPasswordMessage,
[{
text: shared.cancel,
onPress: onCancel
}, {
text: shared.tryAgain,
onPress: onTryAgain
}]
)
return false
}
const connected = await openDb(hash)
if (connected) return true
Alert.alert(
shared.incorrectPassword,
shared.incorrectPasswordMessage,
[{
text: shared.cancel,
onPress: onCancel
}, {
text: shared.tryAgain,
onPress: onTryAgain
}]
)
return false
}