-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move password input to connected component
- Loading branch information
Showing
17 changed files
with
302 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/status_im2/common/standard_authentication/auth_utils.cljs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/status_im2/common/standard_authentication/forgot_password_doc/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(ns status-im2.common.standard-authentication.forgot-password-doc.style) | ||
|
||
(def container {:margin-right 16}) | ||
(def step-container {:flex-direction :row :margin-top 14}) | ||
(def step-content {:margin-left 10}) | ||
(def step-title {:flex-direction :row}) |
52 changes: 52 additions & 0 deletions
52
src/status_im2/common/standard_authentication/forgot_password_doc/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
(ns status-im2.common.standard-authentication.forgot-password-doc.view | ||
(:require [status-im2.common.standard-authentication.forgot-password-doc.style :as style] | ||
[quo2.core :as quo] | ||
[react-native.core :as rn] | ||
[utils.i18n :as i18n])) | ||
|
||
(defn view | ||
[{:keys [shell?]}] | ||
[quo/documentation-drawers | ||
{:title (i18n/label :t/forgot-your-password-info-title) | ||
:shell? shell?} | ||
[rn/view | ||
{:style style/container} | ||
[quo/text {:size :paragraph-2} (i18n/label :t/forgot-your-password-info-description)] | ||
|
||
[rn/view {:style style/step-container} | ||
[quo/step {:in-blur-view? shell?} 1] | ||
[rn/view | ||
{:style style/step-content} | ||
[quo/text {:size :paragraph-2 :weight :semi-bold} | ||
(i18n/label :t/forgot-your-password-info-remove-app)] | ||
[quo/text {:size :paragraph-2} (i18n/label :t/forgot-your-password-info-remove-app-description)]]] | ||
|
||
[rn/view {:style style/step-container} | ||
[quo/step {:in-blur-view? shell?} 2] | ||
[rn/view | ||
{:style style/step-content} | ||
[quo/text {:size :paragraph-2 :weight :semi-bold} | ||
(i18n/label :t/forgot-your-password-info-reinstall-app)] | ||
[quo/text {:size :paragraph-2} | ||
(i18n/label :t/forgot-your-password-info-reinstall-app-description)]]] | ||
|
||
[rn/view {:style style/step-container} | ||
[quo/step {:in-blur-view? shell?} 3] | ||
[rn/view | ||
{:style style/step-content} | ||
[rn/view | ||
{:style style/step-title} | ||
[quo/text {:size :paragraph-2} (str (i18n/label :t/sign-up) " ")] | ||
[quo/text {:size :paragraph-2 :weight :semi-bold} | ||
(i18n/label :t/forgot-your-password-info-signup-with-key)]] | ||
[quo/text {:size :paragraph-2} | ||
(i18n/label :t/forgot-your-password-info-signup-with-key-description)]]] | ||
|
||
[rn/view {:style style/step-container} | ||
[quo/step {:in-blur-view? shell?} 4] | ||
[rn/view | ||
{:style style/step-content} | ||
[quo/text {:size :paragraph-2 :weight :semi-bold} | ||
(i18n/label :t/forgot-your-password-info-create-new-password)] | ||
[quo/text {:size :paragraph-2} | ||
(i18n/label :t/forgot-your-password-info-create-new-password-description)]]]]]) |
6 changes: 6 additions & 0 deletions
6
src/status_im2/common/standard_authentication/password_input/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(ns status-im2.common.standard-authentication.password-input.style) | ||
|
||
(def error-message | ||
{:margin-top 8 | ||
:flex-direction :row | ||
:align-items :center}) |
70 changes: 70 additions & 0 deletions
70
src/status_im2/common/standard_authentication/password_input/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
(ns status-im2.common.standard-authentication.password-input.view | ||
(:require [quo2.core :as quo] | ||
[quo2.foundations.colors :as colors] | ||
[react-native.core :as rn] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf] | ||
[utils.security.core :as security] | ||
[status-im2.common.standard-authentication.password-input.style :as style] | ||
[status-im2.common.standard-authentication.forgot-password-doc.view :as forgot-password-doc] | ||
[quo2.theme :as quo.theme] | ||
[clojure.string :as string])) | ||
|
||
(defn get-error-message | ||
[error] | ||
(if (and (some? error) | ||
(or (= error "file is not a database") | ||
(string/starts-with? error "failed to set ") | ||
(string/starts-with? error "Failed"))) | ||
(i18n/label :t/oops-wrong-password) | ||
error)) | ||
|
||
(defn- on-change-password | ||
[entered-password] | ||
(rf/dispatch [:set-in [:profile/login :password] | ||
(security/mask-data entered-password)]) | ||
(rf/dispatch [:set-in [:profile/login :error] ""])) | ||
|
||
(defn- view-internal | ||
[{:keys [default-password theme shell?]}] | ||
(let [{:keys [error processing]} (rf/sub [:profile/login]) | ||
error-message (get-error-message error) | ||
error? (boolean (seq error-message))] | ||
[:<> | ||
[quo/input | ||
{:type :password | ||
:blur? true | ||
:disabled? processing | ||
:placeholder (i18n/label :t/type-your-password) | ||
:auto-focus true | ||
:error? error? | ||
:label (i18n/label :t/profile-password) | ||
:on-change-text on-change-password | ||
:default-value (security/safe-unmask-data default-password)}] | ||
(when error? | ||
[rn/view {:style style/error-message} | ||
[quo/info-message | ||
{:type :error | ||
:size :default | ||
:icon :i/info} | ||
error-message] | ||
[rn/pressable | ||
{:hit-slop {:top 6 :bottom 20 :left 0 :right 0} | ||
:disabled processing | ||
:on-press (fn [] | ||
(rn/dismiss-keyboard!) | ||
(rf/dispatch [:show-bottom-sheet | ||
{:content #(forgot-password-doc/view {:shell? shell?}) | ||
:theme theme | ||
:shell? shell?}]))} | ||
[rn/text | ||
{:style {:text-decoration-line :underline | ||
:color (colors/theme-colors | ||
(colors/custom-color :danger 50) | ||
(colors/custom-color :danger 60) | ||
theme)} | ||
:size :paragraph-2 | ||
:suppress-highlighting true} | ||
(i18n/label :t/forgot-password)]]])])) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
77 changes: 42 additions & 35 deletions
77
.../common/standard_authentication/view.cljs → ...rd_authentication/standard_auth/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.