mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🐛 Fix change email and password for users signed in via social login
This commit is contained in:
parent
fc857aad08
commit
b2b91bfa57
5 changed files with 16 additions and 9 deletions
|
@ -52,6 +52,7 @@
|
|||
- Forbid empty names for assets [Taiga #5056](https://tree.taiga.io/project/penpot/issue/5056)
|
||||
- Select children after ungroup action [Taiga #4917](https://tree.taiga.io/project/penpot/issue/4917)
|
||||
- Fix problem with guides not showing when moving over nested frames [Taiga #4905](https://tree.taiga.io/project/penpot/issue/4905)
|
||||
- Fix change email and password for users signed in via social login [Taiga #4273](https://tree.taiga.io/project/penpot/issue/4273)
|
||||
|
||||
### :heart: Community contributions by (Thank you!)
|
||||
- To @ondrejkonec: for contributing to the code with:
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
(declare invalidate-profile-session!)
|
||||
|
||||
(s/def ::password ::us/not-empty-string)
|
||||
(s/def ::old-password ::us/not-empty-string)
|
||||
(s/def ::old-password (s/nilable ::us/string))
|
||||
|
||||
(s/def ::update-profile-password
|
||||
(s/keys :req [::rpc/profile-id]
|
||||
|
@ -145,7 +145,8 @@
|
|||
(defn- validate-password!
|
||||
[conn {:keys [profile-id old-password] :as params}]
|
||||
(let [profile (db/get-by-id conn :profile profile-id ::db/for-update? true)]
|
||||
(when-not (:valid (auth/verify-password old-password (:password profile)))
|
||||
(when (and (not= (:password profile) "!")
|
||||
(not (:valid (auth/verify-password old-password (:password profile)))))
|
||||
(ex/raise :type :validation
|
||||
:code :old-password-not-match))
|
||||
profile))
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
(s/def ::path ::us/string)
|
||||
(s/def ::profile-id ::us/uuid)
|
||||
(s/def ::password ::us/not-empty-string)
|
||||
(s/def ::old-password ::us/not-empty-string)
|
||||
(s/def ::old-password (s/nilable ::us/string))
|
||||
(s/def ::theme ::us/string)
|
||||
|
||||
;; --- MUTATION: Update Profile (own)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
(s/def ::created-at ::us/inst)
|
||||
(s/def ::password-1 ::us/string)
|
||||
(s/def ::password-2 ::us/string)
|
||||
(s/def ::password-old ::us/string)
|
||||
(s/def ::password-old (s/nilable ::us/string))
|
||||
|
||||
(s/def ::profile
|
||||
(s/keys :req-un [::id]
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
(defn- on-success
|
||||
[form]
|
||||
(reset! form nil)
|
||||
(let [msg (tr "dashboard.notifications.password-saved")]
|
||||
(let [password-old-node (dom/get-element "password-old")
|
||||
msg (tr "dashboard.notifications.password-saved")]
|
||||
(dom/clean-value! password-old-node)
|
||||
(dom/focus! password-old-node)
|
||||
(st/emit! (dm/success msg))))
|
||||
|
||||
(defn- on-submit
|
||||
|
@ -45,7 +48,7 @@
|
|||
|
||||
(s/def ::password-1 ::us/not-empty-string)
|
||||
(s/def ::password-2 ::us/not-empty-string)
|
||||
(s/def ::password-old ::us/not-empty-string)
|
||||
(s/def ::password-old (s/nilable ::us/string))
|
||||
|
||||
(defn- password-equality
|
||||
[errors data]
|
||||
|
@ -66,9 +69,10 @@
|
|||
|
||||
(mf/defc password-form
|
||||
[{:keys [locale] :as props}]
|
||||
(let [form (fm/use-form :spec ::password-form
|
||||
:validators [password-equality]
|
||||
:initial {})]
|
||||
(let [initial (mf/use-memo (constantly {:password-old nil}))
|
||||
form (fm/use-form :spec ::password-form
|
||||
:validators [password-equality]
|
||||
:initial initial)]
|
||||
[:& fm/form {:class "password-form"
|
||||
:on-submit on-submit
|
||||
:form form}
|
||||
|
@ -77,6 +81,7 @@
|
|||
[:& fm/input
|
||||
{:type "password"
|
||||
:name :password-old
|
||||
:auto-focus? true
|
||||
:label (t locale "labels.old-password")}]]
|
||||
|
||||
[:div.fields-row
|
||||
|
|
Loading…
Reference in a new issue