fix signup process
This commit is contained in:
parent
c878fba6f1
commit
763aac2141
|
@ -10,7 +10,7 @@
|
||||||
[prismatic/schema "1.0.4"]
|
[prismatic/schema "1.0.4"]
|
||||||
^{:voom {:repo "git@github.com:status-im/status-lib.git"
|
^{:voom {:repo "git@github.com:status-im/status-lib.git"
|
||||||
:branch "master"}}
|
:branch "master"}}
|
||||||
[status-im/protocol "0.1.1-20160630_104454-gd663db0"]
|
[status-im/protocol "0.1.1-20160630_153846-gbf92f5f"]
|
||||||
[natal-shell "0.1.6"]
|
[natal-shell "0.1.6"]
|
||||||
[com.andrewmcveigh/cljs-time "0.4.0"]]
|
[com.andrewmcveigh/cljs-time "0.4.0"]]
|
||||||
:plugins [[lein-cljsbuild "1.1.1"]
|
:plugins [[lein-cljsbuild "1.1.1"]
|
||||||
|
|
|
@ -18,13 +18,14 @@
|
||||||
(defn account-created [result]
|
(defn account-created [result]
|
||||||
(let [data (json->clj result)
|
(let [data (json->clj result)
|
||||||
public-key (:pubkey data)
|
public-key (:pubkey data)
|
||||||
address (:address data)]
|
address (:address data)
|
||||||
|
account {:public-key public-key
|
||||||
|
:address address}]
|
||||||
(log/debug "Created account: " result)
|
(log/debug "Created account: " result)
|
||||||
(when (not (str/blank? public-key))
|
(when (not (str/blank? public-key))
|
||||||
(do
|
(do
|
||||||
(dispatch [:initialize-protocol public-key])
|
(dispatch [:initialize-protocol account])
|
||||||
(dispatch [:add-account {:address address
|
(dispatch [:add-account account])))))
|
||||||
:public-key public-key}])))))
|
|
||||||
|
|
||||||
(register-handler :create-account
|
(register-handler :create-account
|
||||||
(-> (fn [db [_ password]]
|
(-> (fn [db [_ password]]
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
(ns status-im.handlers.server
|
(ns status-im.handlers.server
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[status-im.utils.utils :refer [log on-error http-post]]
|
[status-im.utils.utils :refer [on-error http-post]]
|
||||||
[status-im.utils.logging :as log]))
|
[status-im.utils.logging :as log]))
|
||||||
|
|
||||||
(defn sign-up
|
(defn sign-up
|
||||||
[db phone-number handler]
|
[db phone-number handler]
|
||||||
;(user-data/save-phone-number phone-number)
|
(let [{:keys [public-key address] :as account} (get-in db [:user-identity])]
|
||||||
(http-post "sign-up" {:phone-number phone-number
|
;(user-data/save-phone-number phone-number)
|
||||||
:whisper-identity (get-in db [:user-identity :public])}
|
(log/debug "signing up with public-key" public-key "and phone " phone-number)
|
||||||
(fn [body]
|
(http-post "sign-up" {:phone-number phone-number
|
||||||
(log body)
|
:whisper-identity public-key
|
||||||
(handler)))
|
:address address}
|
||||||
db)
|
(fn [body]
|
||||||
|
(log/debug body)
|
||||||
|
(handler)))
|
||||||
|
db))
|
||||||
|
|
||||||
(defn sign-up-confirm
|
(defn sign-up-confirm
|
||||||
[confirmation-code handler]
|
[confirmation-code handler]
|
||||||
|
|
|
@ -12,13 +12,11 @@
|
||||||
(assoc-in db db/protocol-initialized-path initialized?))
|
(assoc-in db db/protocol-initialized-path initialized?))
|
||||||
|
|
||||||
(defn update-identity [db identity]
|
(defn update-identity [db identity]
|
||||||
(let [password (:identity-password db)
|
(let [identity-string (to-edn-string identity)]
|
||||||
encrypted (password-encrypt password (to-edn-string identity))]
|
(s/put kv/kv-store :identity identity-string)
|
||||||
(s/put kv/kv-store :identity encrypted)
|
|
||||||
(assoc db :user-identity identity)))
|
(assoc db :user-identity identity)))
|
||||||
|
|
||||||
(defn stored-identity [db]
|
(defn stored-identity [db]
|
||||||
(let [encrypted (s/get kv/kv-store :identity)
|
(let [identity (s/get kv/kv-store :identity)]
|
||||||
password (:identity-password db)]
|
(when identity
|
||||||
(when encrypted
|
(read-string identity))))
|
||||||
(read-string (password-decrypt password encrypted)))))
|
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
phone-number [:get :phone-number]
|
phone-number [:get :phone-number]
|
||||||
email [:get :email]
|
email [:get :email]
|
||||||
status [:get :status]
|
status [:get :status]
|
||||||
identity [:get-in [:user-identity :public]]]
|
identity [:get-in [:user-identity :public-key]]]
|
||||||
[scroll-view {:style st/profile}
|
[scroll-view {:style st/profile}
|
||||||
[touchable-highlight {:style st/back-btn-touchable
|
[touchable-highlight {:style st/back-btn-touchable
|
||||||
:on-press #(dispatch [:navigate-back])}
|
:on-press #(dispatch [:navigate-back])}
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
(register-handler :initialize-protocol
|
(register-handler :initialize-protocol
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [db [_ public-key]]
|
(fn [db [_ account]]
|
||||||
(init-protocol public-key (make-handler db)))))
|
(init-protocol account (make-handler db)))))
|
||||||
|
|
||||||
(register-handler :protocol-initialized
|
(register-handler :protocol-initialized
|
||||||
(fn [db [_ identity]]
|
(fn [db [_ identity]]
|
||||||
|
|
Loading…
Reference in New Issue