mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
✨ Add minor adjustments to the auth events (#9027)
This commit is contained in:
parent
f5271dabee
commit
de27ea904d
@ -44,6 +44,10 @@ export PENPOT_FLAGS="\
|
|||||||
enable-redis-cache \
|
enable-redis-cache \
|
||||||
enable-subscriptions";
|
enable-subscriptions";
|
||||||
|
|
||||||
|
# Uncomment for nexus integration testing
|
||||||
|
# export PENPOT_FLAGS="$PENPOT_FLAGS enable-audit-log-archive";
|
||||||
|
# export PENPOT_AUDIT_LOG_ARCHIVE_URI="http://localhost:6070/api/audit";
|
||||||
|
|
||||||
# Default deletion delay for devenv
|
# Default deletion delay for devenv
|
||||||
export PENPOT_DELETION_DELAY="24h"
|
export PENPOT_DELETION_DELAY="24h"
|
||||||
|
|
||||||
|
|||||||
@ -446,6 +446,7 @@
|
|||||||
(when (:create-welcome-file params)
|
(when (:create-welcome-file params)
|
||||||
(let [cfg (dissoc cfg ::db/conn)]
|
(let [cfg (dissoc cfg ::db/conn)]
|
||||||
(wrk/submit! executor (create-welcome-file cfg profile)))))]
|
(wrk/submit! executor (create-welcome-file cfg profile)))))]
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
;; When profile is blocked, we just ignore it and return plain data
|
;; When profile is blocked, we just ignore it and return plain data
|
||||||
(:is-blocked profile)
|
(:is-blocked profile)
|
||||||
@ -453,7 +454,8 @@
|
|||||||
(l/wrn :hint "register attempt for already blocked profile"
|
(l/wrn :hint "register attempt for already blocked profile"
|
||||||
:profile-id (str (:id profile))
|
:profile-id (str (:id profile))
|
||||||
:profile-email (:email profile))
|
:profile-email (:email profile))
|
||||||
(rph/with-meta {:email (:email profile)}
|
(rph/with-meta {:id (:id profile)
|
||||||
|
:email (:email profile)}
|
||||||
{::audit/replace-props props
|
{::audit/replace-props props
|
||||||
::audit/context {:action "ignore-because-blocked"}
|
::audit/context {:action "ignore-because-blocked"}
|
||||||
::audit/profile-id (:id profile)
|
::audit/profile-id (:id profile)
|
||||||
@ -469,7 +471,9 @@
|
|||||||
(:member-email invitation)))
|
(:member-email invitation)))
|
||||||
(let [invitation (assoc invitation :member-id (:id profile))
|
(let [invitation (assoc invitation :member-id (:id profile))
|
||||||
token (tokens/generate cfg invitation)]
|
token (tokens/generate cfg invitation)]
|
||||||
(-> {:invitation-token token}
|
(-> {:id (:id profile)
|
||||||
|
:email (:email profile)
|
||||||
|
:invitation-token token}
|
||||||
(rph/with-transform (session/create-fn cfg profile claims))
|
(rph/with-transform (session/create-fn cfg profile claims))
|
||||||
(rph/with-meta {::audit/replace-props props
|
(rph/with-meta {::audit/replace-props props
|
||||||
::audit/context {:action "accept-invitation"}
|
::audit/context {:action "accept-invitation"}
|
||||||
@ -492,7 +496,8 @@
|
|||||||
(when-not (eml/has-reports? conn (:email profile))
|
(when-not (eml/has-reports? conn (:email profile))
|
||||||
(send-email-verification! cfg profile))
|
(send-email-verification! cfg profile))
|
||||||
|
|
||||||
(-> {:email (:email profile)}
|
(-> {:id (:id profile)
|
||||||
|
:email (:email profile)}
|
||||||
(rph/with-defer create-welcome-file-when-needed)
|
(rph/with-defer create-welcome-file-when-needed)
|
||||||
(rph/with-meta
|
(rph/with-meta
|
||||||
{::audit/replace-props props
|
{::audit/replace-props props
|
||||||
@ -519,7 +524,8 @@
|
|||||||
{:id (:id profile)})
|
{:id (:id profile)})
|
||||||
(send-email-verification! cfg profile))
|
(send-email-verification! cfg profile))
|
||||||
|
|
||||||
(rph/with-meta {:email (:email profile)}
|
(rph/with-meta {:email (:email profile)
|
||||||
|
:id (:id profile)}
|
||||||
{::audit/replace-props (audit/profile->props profile)
|
{::audit/replace-props (audit/profile->props profile)
|
||||||
::audit/context {:action action}
|
::audit/context {:action action}
|
||||||
::audit/profile-id (:id profile)
|
::audit/profile-id (:id profile)
|
||||||
|
|||||||
@ -195,6 +195,11 @@
|
|||||||
(let [f (obj/get global "externalContextInfo")]
|
(let [f (obj/get global "externalContextInfo")]
|
||||||
(when (fn? f) (f))))
|
(when (fn? f) (f))))
|
||||||
|
|
||||||
|
(defn external-notify-register-success
|
||||||
|
[profile-id]
|
||||||
|
(let [f (obj/get global "externalNotifyRegisterSuccess")]
|
||||||
|
(when (fn? f) (f (str profile-id)))))
|
||||||
|
|
||||||
(defn initialize-external-context-info
|
(defn initialize-external-context-info
|
||||||
[]
|
[]
|
||||||
(let [f (obj/get global "initializeExternalConfigInfo")]
|
(let [f (obj/get global "initializeExternalConfigInfo")]
|
||||||
|
|||||||
@ -276,6 +276,7 @@
|
|||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps on-success-callback)
|
(mf/deps on-success-callback)
|
||||||
(fn [params]
|
(fn [params]
|
||||||
|
(cf/external-notify-register-success (:id params))
|
||||||
(if (fn? on-success-callback)
|
(if (fn? on-success-callback)
|
||||||
(on-success-callback (:email params))
|
(on-success-callback (:email params))
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
(ns app.main.ui.auth.verify-token
|
(ns app.main.ui.auth.verify-token
|
||||||
(:require
|
(:require
|
||||||
|
[app.config :as cf]
|
||||||
[app.main.data.auth :as da]
|
[app.main.data.auth :as da]
|
||||||
[app.main.data.common :as dcm]
|
[app.main.data.common :as dcm]
|
||||||
[app.main.data.notifications :as ntf]
|
[app.main.data.notifications :as ntf]
|
||||||
@ -25,6 +26,7 @@
|
|||||||
|
|
||||||
(defmethod handle-token :verify-email
|
(defmethod handle-token :verify-email
|
||||||
[data]
|
[data]
|
||||||
|
(cf/external-notify-register-success (:profile-id data))
|
||||||
(let [msg (tr "dashboard.notifications.email-verified-successfully")]
|
(let [msg (tr "dashboard.notifications.email-verified-successfully")]
|
||||||
(ts/schedule 1000 #(st/emit! (ntf/success msg)))
|
(ts/schedule 1000 #(st/emit! (ntf/success msg)))
|
||||||
(st/emit! (da/login-from-token data))))
|
(st/emit! (da/login-from-token data))))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user