Skip to content

Commit 29f80d2

Browse files
authored
fix Incorrect error reporting when creating a new profile (#22583)
1 parent 1967469 commit 29f80d2

File tree

1 file changed

+8
-5
lines changed
  • src/status_im/contexts/onboarding/create_password

1 file changed

+8
-5
lines changed

src/status_im/contexts/onboarding/create_password/view.cljs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
(i18n/label :t/password-creation-subtitle)]])
2828

2929
(defn password-inputs
30-
[{:keys [set-password set-repeat-password same-password-length? same-passwords?
30+
[{:keys [set-password set-repeat-password same-passwords? password repeat-password
3131
password-long-enough? password-short-enough?]}]
3232
(let [hint-1-status (if password-long-enough? :success :default)
3333
hint-2-status (if same-passwords? :success :error)
@@ -37,9 +37,10 @@
3737
[error? set-error] (rn/use-state false)]
3838
(rn/use-effect
3939
(fn []
40-
(when (and (not error?) same-password-length? (not same-passwords?))
41-
(set-error true)))
42-
[error? same-password-length? same-passwords?])
40+
(set-error (and (>= (count repeat-password) (count password))
41+
password-long-enough?
42+
(not same-passwords?)))
43+
[password repeat-password same-passwords?]))
4344
[:<>
4445
[password-with-hint/view
4546
{:hint (if (not password-short-enough?)
@@ -57,7 +58,7 @@
5758
{:hint {:text hint-2-text
5859
:status hint-2-status
5960
:shown? (or same-passwords? error?)}
60-
:error? (and error? (not same-passwords?))
61+
:error? error?
6162
:placeholder (i18n/label :t/password-creation-placeholder-2)
6263
:on-change-text set-repeat-password}]]))
6364

@@ -174,6 +175,8 @@
174175
{:password-long-enough? long-enough?
175176
:password-short-enough? short-enough?
176177
:non-empty-password? non-empty?
178+
:password password
179+
:repeat-password repeat-password
177180
:same-passwords? same-passwords?
178181
:same-password-length? same-password-length?
179182
:set-password set-password

0 commit comments

Comments
 (0)