mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 16:18:11 -05:00
🎉 Add helper to devenv for properly reset passwords.
This commit is contained in:
parent
47a77ae1e2
commit
4e271603c2
3 changed files with 22 additions and 5 deletions
|
@ -140,7 +140,7 @@
|
||||||
:code :email-already-exists))
|
:code :email-already-exists))
|
||||||
params))
|
params))
|
||||||
|
|
||||||
(defn- derive-password
|
(defn derive-password
|
||||||
[password]
|
[password]
|
||||||
(hashers/derive password
|
(hashers/derive password
|
||||||
{:alg :argon2id
|
{:alg :argon2id
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
:iterations 20
|
:iterations 20
|
||||||
:parallelism 2}))
|
:parallelism 2}))
|
||||||
|
|
||||||
(defn- verify-password
|
(defn verify-password
|
||||||
[attempt password]
|
[attempt password]
|
||||||
(try
|
(try
|
||||||
(hashers/verify attempt password)
|
(hashers/verify attempt password)
|
||||||
|
|
16
backend/src/app/srepl/dev.clj
Normal file
16
backend/src/app/srepl/dev.clj
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
(ns app.srepl.dev
|
||||||
|
#_:clj-kondo/ignore
|
||||||
|
(:require
|
||||||
|
[app.db :as db]
|
||||||
|
[app.config :as cfg]
|
||||||
|
[app.rpc.mutations.profile :refer [derive-password]]
|
||||||
|
[app.main :refer [system]]))
|
||||||
|
|
||||||
|
(defn reset-passwords
|
||||||
|
[system]
|
||||||
|
(when (not= "devenv" (:host cfg/config))
|
||||||
|
(throw (ex-info "Can't proceed, only allowed this operation on devenv" {})))
|
||||||
|
(db/with-atomic [conn (:app.db/pool system)]
|
||||||
|
(let [password (derive-password "123123")]
|
||||||
|
(db/exec! conn ["update profile set password=?" password]))))
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
"A main namespace for server repl."
|
"A main namespace for server repl."
|
||||||
#_:clj-kondo/ignore
|
#_:clj-kondo/ignore
|
||||||
(:require
|
(:require
|
||||||
[clojure.pprint :refer [pprint]]
|
[app.common.pages :as cp]
|
||||||
|
[app.common.pages.migrations :as pmg]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.main :refer [system]]
|
[app.main :refer [system]]
|
||||||
[app.common.pages.migrations :as pmg]
|
[app.srepl.dev :as dev]
|
||||||
[app.util.blob :as blob]
|
[app.util.blob :as blob]
|
||||||
[app.common.pages :as cp]))
|
[clojure.pprint :refer [pprint]]))
|
||||||
|
|
||||||
(defn update-file
|
(defn update-file
|
||||||
([id f] (update-file id f false))
|
([id f] (update-file id f false))
|
||||||
|
|
Loading…
Add table
Reference in a new issue