mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 04:49:03 -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)
|
- 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)
|
- 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 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!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
- To @ondrejkonec: for contributing to the code with:
|
- To @ondrejkonec: for contributing to the code with:
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
(declare invalidate-profile-session!)
|
(declare invalidate-profile-session!)
|
||||||
|
|
||||||
(s/def ::password ::us/not-empty-string)
|
(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/def ::update-profile-password
|
||||||
(s/keys :req [::rpc/profile-id]
|
(s/keys :req [::rpc/profile-id]
|
||||||
|
@ -145,7 +145,8 @@
|
||||||
(defn- validate-password!
|
(defn- validate-password!
|
||||||
[conn {:keys [profile-id old-password] :as params}]
|
[conn {:keys [profile-id old-password] :as params}]
|
||||||
(let [profile (db/get-by-id conn :profile profile-id ::db/for-update? true)]
|
(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
|
(ex/raise :type :validation
|
||||||
:code :old-password-not-match))
|
:code :old-password-not-match))
|
||||||
profile))
|
profile))
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
(s/def ::path ::us/string)
|
(s/def ::path ::us/string)
|
||||||
(s/def ::profile-id ::us/uuid)
|
(s/def ::profile-id ::us/uuid)
|
||||||
(s/def ::password ::us/not-empty-string)
|
(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)
|
(s/def ::theme ::us/string)
|
||||||
|
|
||||||
;; --- MUTATION: Update Profile (own)
|
;; --- MUTATION: Update Profile (own)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
(s/def ::created-at ::us/inst)
|
(s/def ::created-at ::us/inst)
|
||||||
(s/def ::password-1 ::us/string)
|
(s/def ::password-1 ::us/string)
|
||||||
(s/def ::password-2 ::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/def ::profile
|
||||||
(s/keys :req-un [::id]
|
(s/keys :req-un [::id]
|
||||||
|
|
|
@ -32,7 +32,10 @@
|
||||||
(defn- on-success
|
(defn- on-success
|
||||||
[form]
|
[form]
|
||||||
(reset! form nil)
|
(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))))
|
(st/emit! (dm/success msg))))
|
||||||
|
|
||||||
(defn- on-submit
|
(defn- on-submit
|
||||||
|
@ -45,7 +48,7 @@
|
||||||
|
|
||||||
(s/def ::password-1 ::us/not-empty-string)
|
(s/def ::password-1 ::us/not-empty-string)
|
||||||
(s/def ::password-2 ::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
|
(defn- password-equality
|
||||||
[errors data]
|
[errors data]
|
||||||
|
@ -66,9 +69,10 @@
|
||||||
|
|
||||||
(mf/defc password-form
|
(mf/defc password-form
|
||||||
[{:keys [locale] :as props}]
|
[{:keys [locale] :as props}]
|
||||||
(let [form (fm/use-form :spec ::password-form
|
(let [initial (mf/use-memo (constantly {:password-old nil}))
|
||||||
|
form (fm/use-form :spec ::password-form
|
||||||
:validators [password-equality]
|
:validators [password-equality]
|
||||||
:initial {})]
|
:initial initial)]
|
||||||
[:& fm/form {:class "password-form"
|
[:& fm/form {:class "password-form"
|
||||||
:on-submit on-submit
|
:on-submit on-submit
|
||||||
:form form}
|
:form form}
|
||||||
|
@ -77,6 +81,7 @@
|
||||||
[:& fm/input
|
[:& fm/input
|
||||||
{:type "password"
|
{:type "password"
|
||||||
:name :password-old
|
:name :password-old
|
||||||
|
:auto-focus? true
|
||||||
:label (t locale "labels.old-password")}]]
|
:label (t locale "labels.old-password")}]]
|
||||||
|
|
||||||
[:div.fields-row
|
[:div.fields-row
|
||||||
|
|
Loading…
Add table
Reference in a new issue