From addaeba7064f12452b32ccbb9e468b1cfb90caa3 Mon Sep 17 00:00:00 2001 From: Audrius Molis Date: Thu, 9 Nov 2017 21:23:53 +0200 Subject: [PATCH] Added password validation for Restore Access flow #1224 Added password validation for Restore Access flow #1224 --- src/status_im/constants.cljs | 1 + src/status_im/ui/screens/accounts/recover/db.cljs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 8cc2fade37..961b749730 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -18,6 +18,7 @@ (def content-type-wallet-request "wallet-request") (def content-type-status "status") +(def min-password-length 6) (def max-chat-name-length 20) (def response-suggesstion-resize-duration 100) (def default-number-of-messages 20) diff --git a/src/status_im/ui/screens/accounts/recover/db.cljs b/src/status_im/ui/screens/accounts/recover/db.cljs index ea618ffdc6..f21400fd5d 100644 --- a/src/status_im/ui/screens/accounts/recover/db.cljs +++ b/src/status_im/ui/screens/accounts/recover/db.cljs @@ -1,6 +1,10 @@ (ns status-im.ui.screens.accounts.recover.db - (:require [cljs.spec.alpha :as s] + (:require [cljs.spec.alpha :as spec] + [status-im.constants :as const] status-im.utils.db)) -(s/def ::passphrase :global/not-empty-string) -(s/def ::password :global/not-empty-string) \ No newline at end of file +(defn valid-length? [password] + (>= (count password) const/min-password-length)) + +(spec/def ::passphrase :global/not-empty-string) +(spec/def ::password (spec/and :global/not-empty-string valid-length?))