From 94660fb812399eca450f3302a1395b2e5bdf2e30 Mon Sep 17 00:00:00 2001 From: virvar Date: Mon, 25 Apr 2016 12:06:59 +0300 Subject: [PATCH] Fix #22 Confirmation code stops after first try --- src/syng_im/handlers/sign_up.cljs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/syng_im/handlers/sign_up.cljs b/src/syng_im/handlers/sign_up.cljs index 8b366d08bf..66c5cb6279 100644 --- a/src/syng_im/handlers/sign_up.cljs +++ b/src/syng_im/handlers/sign_up.cljs @@ -40,9 +40,10 @@ (defn sync-contacts [] (dispatch [:sync-contacts on-sync-contacts])) -(defn on-send-code-response [body] +(defn on-send-code-response [msg-id body] (if (:confirmed body) - (do (dispatch [:received-msg + (do (dispatch [:set-chat-command-request msg-id nil]) + (dispatch [:received-msg {:msg-id (random/id) :content "Confirmed" :content-type text-content-type @@ -58,13 +59,12 @@ :from "console" :to "me"}]))) -(defn send-code [code] - (dispatch [:sign-up-confirm code on-send-code-response])) +(defn send-code [msg-id code] + (dispatch [:sign-up-confirm code (partial on-send-code-response msg-id)])) (defn- handle-confirmation-code [msg-id command-key content] - (dispatch [:set-chat-command-request msg-id nil]) (when (= command-key :confirmation-code) - (send-code content))) + (send-code msg-id content))) ;; -- Send phone number ---------------------------------------- (defn on-sign-up-response []