0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

🎉 Add login-with-password flag

As replacement to `login` flag
This commit is contained in:
Andrey Antukh 2022-12-22 16:28:06 +01:00
parent 7f5491f45b
commit 2840cb893e
5 changed files with 11 additions and 7 deletions

View file

@ -2,7 +2,7 @@
export PENPOT_HOST=devenv export PENPOT_HOST=devenv
export PENPOT_TENANT=dev export PENPOT_TENANT=dev
export PENPOT_FLAGS="$PENPOT_FLAGS enable-backend-asserts enable-audit-log enable-transit-readable-response enable-demo-users disable-secure-session-cookies enable-smtp" export PENPOT_FLAGS="$PENPOT_FLAGS enable-backend-asserts enable-audit-log enable-transit-readable-response enable-demo-users disable-secure-session-cookies enable-smtp enable-webhooks"
# export PENPOT_DATABASE_URI="postgresql://172.17.0.1:5432/penpot" # export PENPOT_DATABASE_URI="postgresql://172.17.0.1:5432/penpot"
# export PENPOT_DATABASE_USERNAME="penpot" # export PENPOT_DATABASE_USERNAME="penpot"

View file

@ -2,7 +2,7 @@
export PENPOT_HOST=devenv export PENPOT_HOST=devenv
export PENPOT_TENANT=dev export PENPOT_TENANT=dev
export PENPOT_FLAGS="$PENPOT_FLAGS enable-backend-asserts enable-audit-log enable-transit-readable-response enable-demo-users disable-secure-session-cookies enable-smtp" export PENPOT_FLAGS="$PENPOT_FLAGS enable-backend-asserts enable-audit-log enable-transit-readable-response enable-demo-users disable-secure-session-cookies enable-smtp enable-webhooks"
set -ex set -ex

View file

@ -71,7 +71,8 @@
(defn login-with-password (defn login-with-password
[{:keys [::db/pool session] :as cfg} {:keys [email password scope] :as params}] [{:keys [::db/pool session] :as cfg} {:keys [email password scope] :as params}]
(when-not (contains? cf/flags :login) (when-not (or (contains? cf/flags :login)
(contains? cf/flags :login-with-password))
(ex/raise :type :restriction (ex/raise :type :restriction
:code :login-disabled :code :login-disabled
:hint "login is disabled in this instance")) :hint "login is disabled in this instance"))

View file

@ -12,8 +12,7 @@
(def default (def default
"A common flags that affects both: backend and frontend." "A common flags that affects both: backend and frontend."
[:enable-registration [:enable-registration
:enable-login :enable-login-with-password])
:enable-webhooks])
(defn parse (defn parse
[& flags] [& flags]

View file

@ -171,7 +171,8 @@
:label (tr "auth.password")}]] :label (tr "auth.password")}]]
[:div.buttons-stack [:div.buttons-stack
(when (contains? @cf/flags :login) (when (or (contains? @cf/flags :login)
(contains? @cf/flags :login-with-password))
[:& fm/submit-button [:& fm/submit-button
{:label (tr "auth.login-submit") {:label (tr "auth.login-submit")
:data-test "login-submit"}]) :data-test "login-submit"}])
@ -232,6 +233,7 @@
[:& login-buttons {:params params}] [:& login-buttons {:params params}]
(when (or (contains? @cf/flags :login) (when (or (contains? @cf/flags :login)
(contains? @cf/flags :login-with-password)
(contains? @cf/flags :login-with-ldap)) (contains? @cf/flags :login-with-ldap))
[:span.separator [:span.separator
[:span.line] [:span.line]
@ -239,6 +241,7 @@
[:span.line]])]) [:span.line]])])
(when (or (contains? @cf/flags :login) (when (or (contains? @cf/flags :login)
(contains? @cf/flags :login-with-password)
(contains? @cf/flags :login-with-ldap)) (contains? @cf/flags :login-with-ldap))
[:& login-form {:params params :on-success-callback on-success-callback}])]) [:& login-form {:params params :on-success-callback on-success-callback}])])
@ -251,7 +254,8 @@
[:& login-methods {:params params}] [:& login-methods {:params params}]
[:div.links [:div.links
(when (contains? @cf/flags :login) (when (or (contains? @cf/flags :login)
(contains? @cf/flags :login-with-password))
[:div.link-entry [:div.link-entry
[:& lk/link {:action #(st/emit! (rt/nav :auth-recovery-request)) [:& lk/link {:action #(st/emit! (rt/nav :auth-recovery-request))
:data-test "forgot-password"} :data-test "forgot-password"}