Merge pull request #200 from status-im/feature/show-mnemonic-#199

show mnemonic on account creation
This commit is contained in:
Roman Volosovskyi 2016-08-27 14:38:14 +03:00 committed by GitHub
commit 995622307f
4 changed files with 15 additions and 17 deletions

View File

@ -36,6 +36,7 @@
(let [data (json->clj result) (let [data (json->clj result)
public-key (:pubkey data) public-key (:pubkey data)
address (:address data) address (:address data)
mnemonic (:mnemonic data)
account {:public-key public-key account {:public-key public-key
:address address :address address
:name address :name address
@ -44,7 +45,8 @@
(when (not (str/blank? public-key)) (when (not (str/blank? public-key))
(do (do
(dispatch-sync [:add-account account]) (dispatch-sync [:add-account account])
(dispatch [:login-account address password]))))) (dispatch-sync [:save-password password mnemonic])
(dispatch-sync [:login-account address password])))))
(register-handler :create-account (register-handler :create-account
(after #(dispatch [:init-wallet-chat])) (after #(dispatch [:init-wallet-chat]))

View File

@ -183,9 +183,8 @@
(init-console-chat db false))) (init-console-chat db false)))
(register-handler :save-password (register-handler :save-password
(fn [db [_ password]] (fn [db [_ password mnemonic]]
(sign-up-service/save-password password) (sign-up-service/save-password password mnemonic)
(dispatch [:create-account password])
(assoc db :password-saved true))) (assoc db :password-saved true)))
(register-handler :sign-up (register-handler :sign-up

View File

@ -107,7 +107,7 @@
:to "me"}]))) :to "me"}])))
;; -- Saving password ---------------------------------------- ;; -- Saving password ----------------------------------------
(defn save-password [password] (defn save-password [password mnemonic]
;; TODO validate and save password ;; TODO validate and save password
(dispatch [:received-message (dispatch [:received-message
{:msg-id (random/id) {:msg-id (random/id)
@ -133,17 +133,14 @@
:from "console" :from "console"
:to "me" :to "me"
:new? false}]) :new? false}])
;; TODO generate passphrase (dispatch [:received-message
(let [passphrase (str "The brash businessman's braggadocio and public squabbing with " {:msg-id (random/id)
"candidates in the US presidential election")] :content mnemonic
(dispatch [:received-message :content-type text-content-type
{:msg-id (random/id) :outgoing false
:content passphrase :from "console"
:content-type text-content-type :to "me"
:outgoing false :new? false}])
:from "console"
:to "me"
:new? false}]))
(dispatch [:received-message (dispatch [:received-message
{:msg-id "8" {:msg-id "8"
:content (label :t/written-down) :content (label :t/written-down)

View File

@ -20,7 +20,7 @@
(def console-events (def console-events
{:save-password (fn [[parameter]] {:save-password (fn [[parameter]]
(dispatch [:save-password parameter])) (dispatch [:create-account parameter]))
:sign-up (fn [[parameter]] :sign-up (fn [[parameter]]
(dispatch [:sign-up parameter])) (dispatch [:sign-up parameter]))
:confirm-sign-up (fn [[parameter]] :confirm-sign-up (fn [[parameter]]