mirror of
https://github.com/penpot/penpot.git
synced 2025-07-06 00:57:15 +02:00
✨ Improve posible race condition handling on user registration.
This commit is contained in:
parent
6e08c6bc35
commit
992a8e9aef
1 changed files with 18 additions and 9 deletions
|
@ -170,6 +170,7 @@
|
||||||
active? (if demo? true is-active)
|
active? (if demo? true is-active)
|
||||||
props (db/tjson (or props {}))
|
props (db/tjson (or props {}))
|
||||||
password (derive-password password)]
|
password (derive-password password)]
|
||||||
|
(try
|
||||||
(-> (db/insert! conn :profile
|
(-> (db/insert! conn :profile
|
||||||
{:id id
|
{:id id
|
||||||
:fullname fullname
|
:fullname fullname
|
||||||
|
@ -178,7 +179,15 @@
|
||||||
:props props
|
:props props
|
||||||
:is-active active?
|
:is-active active?
|
||||||
:is-demo demo?})
|
:is-demo demo?})
|
||||||
(update :props db/decode-transit-pgobject))))
|
(update :props db/decode-transit-pgobject))
|
||||||
|
(catch org.postgresql.util.PSQLException e
|
||||||
|
(let [state (.getSQLState e)]
|
||||||
|
(if (not= state "23505")
|
||||||
|
(throw e)
|
||||||
|
(ex/raise :type :validation
|
||||||
|
:code :email-already-exists
|
||||||
|
:cause e)))))))
|
||||||
|
|
||||||
|
|
||||||
(defn- create-profile-relations
|
(defn- create-profile-relations
|
||||||
[conn profile]
|
[conn profile]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue