Browse Source

Fix setEncryptionKey

master
Loëck Vézien 7 years ago
committed by meriadec
parent
commit
216059f61c
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 10
      src/components/SettingsPage/sections/Profile.js

10
src/components/SettingsPage/sections/Profile.js

@ -51,9 +51,11 @@ class TabProfile extends PureComponent<Props, State> {
isPasswordModalOpened: false, isPasswordModalOpened: false,
} }
setPassword = hash => { setPassword = password => {
const { saveSettings, unlock } = this.props const { saveSettings, unlock } = this.props
setEncryptionKey('accounts', hash) window.requestIdleCallback(() => {
setEncryptionKey('accounts', password)
const hash = password ? bcrypt.hashSync(password, 8) : undefined
saveSettings({ saveSettings({
password: { password: {
isEnabled: hash !== undefined, isEnabled: hash !== undefined,
@ -61,6 +63,7 @@ class TabProfile extends PureComponent<Props, State> {
}, },
}) })
unlock() unlock()
})
} }
debounceSaveUsername = debounce( debounceSaveUsername = debounce(
@ -94,8 +97,7 @@ class TabProfile extends PureComponent<Props, State> {
handleChangePassword = (password: ?string) => { handleChangePassword = (password: ?string) => {
if (password) { if (password) {
const hash = bcrypt.hashSync(password, 8) this.setPassword(password)
this.setPassword(hash)
this.handleClosePasswordModal() this.handleClosePasswordModal()
} }
} }

Loading…
Cancel
Save