diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index 1ca637396..aed780694 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -87,7 +87,10 @@ :ldap-attrs-fullname "cn" ;; a server prop key where initial project is stored. - :initial-project-skey "initial-project"}) + :initial-project-skey "initial-project" + + ;; time to avoid email sending after profile modification + :email-verify-threshold "15m"}) (s/def ::default-rpc-rlimit ::us/vector-of-strings) (s/def ::rpc-rlimit-config ::fs/path) @@ -213,6 +216,7 @@ (s/def ::telemetry-uri ::us/string) (s/def ::telemetry-with-taiga ::us/boolean) (s/def ::tenant ::us/string) +(s/def ::email-verify-threshold ::dt/duration) (s/def ::config (s/keys :opt-un [::secret-key @@ -334,7 +338,8 @@ ::telemetry-uri ::telemetry-referer ::telemetry-with-taiga - ::tenant])) + ::tenant + ::email-verify-threshold])) (def default-flags [:enable-backend-api-doc diff --git a/backend/src/app/rpc/commands/auth.clj b/backend/src/app/rpc/commands/auth.clj index b38fa83b5..e4b36e84b 100644 --- a/backend/src/app/rpc/commands/auth.clj +++ b/backend/src/app/rpc/commands/auth.clj @@ -38,13 +38,11 @@ (def schema:token [::sm/word-string {:max 6000}]) -(def ^:private default-verify-threshold - (dt/duration "15m")) - (defn- elapsed-verify-threshold? [profile] - (let [elapsed (dt/diff (:modified-at profile) (dt/now))] - (pos? (compare elapsed default-verify-threshold)))) + (let [elapsed (dt/diff (:modified-at profile) (dt/now)) + verify-threshold (cf/get :email-verify-threshold)] + (pos? (compare elapsed verify-threshold)))) ;; ---- COMMAND: login with password