This commit is contained in:
Roman Volosovskyi 2016-12-05 17:31:48 +02:00
parent 6699e6e667
commit 49c604acdd
3 changed files with 13 additions and 10 deletions

View File

@ -257,15 +257,15 @@
(register-handler :account-generation-message
(u/side-effect!
(fn [{:keys [chats]}]
(when (> 4 (count (get-in chats [console-chat-id :messages])))
(fn [_]
(when (not (messages/get-by-id sign-up-service/passphraze-message-id))
(sign-up-service/account-generation-message)))))
(register-handler :show-mnemonic
(u/side-effect!
(fn [{:keys [chats]} [_ mnemonic]]
(let [messages-count (count (get-in chats [console-chat-id :messages]))]
(sign-up-service/passphrase-messages mnemonic messages-count)))))
(fn [_ [_ mnemonic]]
(let [crazy-math-message? (messages/get-by-id sign-up-service/crazy-math-message)]
(sign-up-service/passphrase-messages mnemonic crazy-math-message?)))))
(register-handler :sign-up
(after (fn [_ [_ phone-number]]

View File

@ -112,10 +112,11 @@
:from console-chat-id
:to "me"}]))
(def crazy-math-message "crazy-math-message")
;; -- Saving password ----------------------------------------
(defn account-generation-message []
(dispatch [:received-message
{:message-id (random/id)
{:message-id crazy-math-message
:content (label :t/account-generation-message)
:content-type text-content-type
:outgoing false
@ -123,10 +124,12 @@
:from console-chat-id
:to "me"}]))
(defn passphrase-messages [mnemonic messages-count]
(def passphraze-message-id "passphraze-message")
(defn passphrase-messages [mnemonic crazy-math-message?]
(dispatch [:received-message
{:message-id (random/id)
:content (if (> messages-count 3)
{:message-id passphraze-message-id
:content (if crazy-math-message?
(label :t/phew-here-is-your-passphrase)
(label :t/here-is-your-passphrase))
:content-type text-content-type

View File

@ -69,7 +69,7 @@
(defn create-account [password on-result]
(when status
(let [callback (fn [data]
(reset! account-creation? true)
(reset! account-creation? false)
(on-result data))]
(swap! account-creation?
(fn [creation?]