Unify encrypt function

This commit is contained in:
Julia Friesel
2018-09-14 09:20:21 +02:00
parent 6c49d8a36c
commit 3dbc26f50a
5 changed files with 34 additions and 52 deletions
+3 -4
View File
@@ -12,7 +12,7 @@ import {
} from '../../local-storage'
import styles from '../../styles/index'
import { settings as labels, shared } from '../labels'
import { requestHash, openDb } from '../../db'
import { requestHash, openDb, changeEncryptionAndRestartApp } from '../../db'
export default class PasswordSetting extends Component {
constructor(props) {
@@ -40,9 +40,6 @@ export default class PasswordSetting extends Component {
if (msg.type != 'sha512') return
try {
await openDb({ hash: msg.message, persistConnection: false })
this.setState({
enteringCurrentPassword: false
})
} catch (err) {
Alert.alert(
shared.incorrectPassword,
@@ -60,7 +57,9 @@ export default class PasswordSetting extends Component {
onPress: () => this.setState({currentPassword: null})
}]
)
return
}
await changeEncryptionAndRestartApp()
}
render() {