Skip to content

Commit

Permalink
Don't send mail when neither username nor email is found.
Browse files Browse the repository at this point in the history
  • Loading branch information
soegaard committed Jan 24, 2020
1 parent 4c405a0 commit 61c7cef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
9 changes: 6 additions & 3 deletions app-racket-stories/control.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,12 @@
(def result (html-reset-password-sent-page))
(def ue (get-binding #"usernameoremail" bytes->string/utf-8))
(def u (or (get-user/username ue) (get-user/email ue)))
(def t (new-reset-password-token #:user u))
(def url (~a "https://racket-stories.com/password-recovery/" t))
(send-reset-password-email (user-email u) (user-username u) url)
(when (user? u)
; don't do anything if the username/email is not found
; (we can't reveal which email adresses we have as users)
(def t (new-reset-password-token #:user u))
(def url (~a "https://racket-stories.com/password-recovery/" t))
(send-reset-password-email (user-email u) (user-username u) url))
(response/output (λ (out) (display result out))))

(define (do-password-recovery req token)
Expand Down
19 changes: 18 additions & 1 deletion app-racket-stories/model.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,24 @@ HERE
]
[_ (void)]))


#;(begin (current-database (connect-to-database))
(drop-tables)
(init-database))

;;;
;;; Schema -> PostGresql SQL
;;;

; The generates the SQL used to create the table.

;; (require (prefix-in ast: deta/private/ast)
;; deta/private/schema
;; deta/private/dialect/dialect
;; deta/private/dialect/postgresql)
;; (let ([s (schema-registry-lookup 'reset-password-token)])
;; (displayln (dialect-emit-ddl postgresql-dialect
;; (ast:create-table (schema-table s) (schema-fields s)))))




0 comments on commit 61c7cef

Please sign in to comment.