mirror of
https://github.com/amark/gun.git
synced 2025-06-05 21:56:51 +00:00
Yet another bugfix for alias & PIN authrecall
This commit is contained in:
parent
491356382f
commit
8e44147f45
8
sea.js
8
sea.js
@ -499,7 +499,7 @@
|
||||
let err
|
||||
// Yes, then attempt to log into each one until we find ours!
|
||||
// (if two users have the same username AND the same password... that would be bad)
|
||||
const [ { key, at, proof } = {} ] = await Promise
|
||||
const [ { key, at, proof, pin: newPin } = {} ] = await Promise
|
||||
.all(aliases.filter(({ at: { put } = {} }) => !!put)
|
||||
.map(async ({ at, pub }) => {
|
||||
const readStorageData = async (args) => {
|
||||
@ -539,7 +539,7 @@
|
||||
const { epub } = at.put
|
||||
// Success! we've found our private data!
|
||||
err = null
|
||||
return { proof, at, key: { pub, priv, epriv, epub } }
|
||||
return { proof, at, pin, key: { pub, priv, epriv, epub } }
|
||||
} catch (e) {
|
||||
err = 'Failed to decrypt private key!'
|
||||
return
|
||||
@ -553,11 +553,11 @@
|
||||
// now we have AES decrypted the private key,
|
||||
// if we were successful, then that means we're logged in!
|
||||
try {
|
||||
await updatestorage(proof, key, pin)(key)
|
||||
await updatestorage(proof, key, newPin || pin)(key)
|
||||
|
||||
const user = Object.assign(key, { at, proof })
|
||||
|
||||
return await finalizelogin(alias, user, root, { pin })
|
||||
return await finalizelogin(alias, user, root, { pin: newPin || pin })
|
||||
} catch (e) { // TODO: right log message ?
|
||||
Gun.log('Failed to finalize login with new password!')
|
||||
const { err = '' } = e || {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user