Skip to content

Commit

Permalink
Merge pull request #5 from Orcpub/develop
Browse files Browse the repository at this point in the history
Merge with fork
  • Loading branch information
John Liss authored Jan 21, 2019
2 parents b2f9821 + 8adcfe5 commit 27cf62b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions deploy/snakeoil.bat
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions src/clj/orcpub/email.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)))}]})))

11 changes: 6 additions & 5 deletions src/clj/orcpub/routes.clj
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 27cf62b

Please sign in to comment.