[#5745] validate accout recover result
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
This commit is contained in:
parent
94ee56e43a
commit
76036c88cc
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
## [0.9.28 - Unreleased]
|
||||
### Added
|
||||
### Fixed
|
||||
Fix app freeze on recover with wrong password
|
||||
### Changed
|
||||
|
||||
## [0.9.27]
|
||||
|
|
|
@ -58,18 +58,20 @@
|
|||
(let [password (get-in db [:accounts/recover :password])]
|
||||
{:db (assoc-in db [:accounts/recover :password-error] (check-password-errors password))}))
|
||||
|
||||
(defn on-account-recovered [result password cofx]
|
||||
(let [db (:db cofx)
|
||||
data (types/json->clj result)
|
||||
pubkey (:pubkey data)
|
||||
account {:pubkey pubkey
|
||||
:address (:address data)
|
||||
(defn validate-recover-result [{:keys [error pubkey address]} password {:keys [db] :as cofx}]
|
||||
(if (empty? error)
|
||||
(let [account {:pubkey pubkey
|
||||
:address address
|
||||
:photo-path (identicon/identicon pubkey)
|
||||
:mnemonic ""}]
|
||||
(accounts.create/on-account-created account password true cofx))
|
||||
{:db (assoc-in db [:accounts/recover :password-error] :recover-password-invalid)}))
|
||||
|
||||
(defn on-account-recovered [result password {:keys [db] :as cofx}]
|
||||
(let [data (types/json->clj result)]
|
||||
(handlers-macro/merge-fx cofx
|
||||
{:db (assoc-in db [:accounts/recover :processing?] false)}
|
||||
(accounts.create/on-account-created account password true))))
|
||||
(validate-recover-result data password))))
|
||||
|
||||
(defn recover-account [{:keys [db]}]
|
||||
(let [{:keys [password passphrase]} (:accounts/recover db)]
|
||||
|
|
|
@ -460,6 +460,7 @@
|
|||
"invalid-number": "Invalid number",
|
||||
"type-a-message": "Type a message...",
|
||||
"recover-password-too-short": "Password is too short",
|
||||
"recover-password-invalid": "This account already exists but passwords do not match",
|
||||
"rinkeby-network": "Rinkeby test network",
|
||||
"faq": "Frequently asked questions",
|
||||
"currency-display-name-sar": "Saudi Arabia Riyal",
|
||||
|
|
Loading…
Reference in New Issue