diff --git a/deploy/snakeoil.bat b/deploy/snakeoil.bat new file mode 100644 index 000000000..7c1fbcb2a --- /dev/null +++ b/deploy/snakeoil.bat @@ -0,0 +1 @@ +openssl req -subj "/C=PL/ST=Warsaw/L=Warsaw/O=Orcpub Web/OU=Orcpub/CN=*/" -x509 -nodes -days 365 -newkey rsa:2048 -keyout snakeoil.key -out snakeoil.crt diff --git a/src/clj/orcpub/email.clj b/src/clj/orcpub/email.clj index f45eb4f9f..ab1126257 100644 --- a/src/clj/orcpub/email.clj +++ b/src/clj/orcpub/email.clj @@ -2,6 +2,7 @@ (:require [hiccup.core :as hiccup] [postal.core :as postal] [environ.core :as environ] + [clojure.pprint :as pprint] [orcpub.route-map :as routes])) (defn verification-email-html [first-and-last-name username verification-url] @@ -75,12 +76,12 @@ (defn send-error-email [context exception] (if (not-empty (environ/env :email-errors-to)) (postal/send-message (email-cfg) - {:from (str "OrcPub Errors <" (environ/env :email-errors-to) ">")} + {:from (str "OrcPub Errors <" (environ/env :email-errors-to) ">") :to (str (environ/env :email-errors-to)) :subject "Exception" :body [{:type "text/plain" :content (let [writer (java.io.StringWriter.)] (do (clojure.pprint/pprint (:request context) writer) (clojure.pprint/pprint (or (ex-data exception) exception) writer) - (str writer)))}]))) + (str writer)))}]}))) diff --git a/src/clj/orcpub/routes.clj b/src/clj/orcpub/routes.clj index 1f577787b..f4539639e 100644 --- a/src/clj/orcpub/routes.clj +++ b/src/clj/orcpub/routes.clj @@ -1,5 +1,5 @@ (ns orcpub.routes - (:require [io.pedestal.http :as http] + (:require [io.pedestal.http :as http] [io.pedestal.http.route :as route] [io.pedestal.test :as test] [io.pedestal.http.ring-middlewares :as ring] @@ -46,7 +46,7 @@ [environ.core :as environ] [clojure.set :as sets]) (:import (org.apache.pdfbox.pdmodel.interactive.form PDCheckBox PDComboBox PDListBox PDRadioButton PDTextField) - + (org.apache.pdfbox.pdmodel PDDocument PDPage PDPageContentStream) (org.apache.pdfbox.pdmodel.graphics.image PDImageXObject) (java.io ByteArrayOutputStream ByteArrayInputStream) @@ -195,7 +195,7 @@ (defn bad-credentials-response [db username ip] (security/add-failed-login-attempt! username ip) (if (security/too-many-attempts-for-username? username) - (login-error errors/too-many-attempts) + (login-error errors/too-many-attempts) (let [user-for-username (find-user-by-username-or-email db username)] (login-error (if (:db/id user-for-username) errors/bad-credentials @@ -420,7 +420,8 @@ conn [{:db/id user-id :orcpub.user/password (hashers/encrypt (s/trim password)) - :orcpub.user/password-reset (java.util.Date.)}]) + :orcpub.user/password-reset (java.util.Date.) + :orcpub.user/verified? true}]) {:status 200}) (defn reset-password [{:keys [json-params db conn cookies identity] :as request}] @@ -582,7 +583,7 @@ :orcpub.user/password-reset-sent :orcpub.user/password-reset] :as user} (first-user-by db user-by-password-reset-key-query key) - expired? (password-reset-expired? password-reset-sent) + expired? (password-reset-expired? password-reset-sent) already-reset? (password-already-reset? password-reset password-reset-sent)] (cond expired? (redirect route-map/password-reset-expired-route)