Title / Description
Code (defn request-email-change! "When the requested new-email is equal to the current email, this is still handled as a real change request. Returns: - nil if validations fail - the updated object otherwise" [user-id new-email] (let [user (find-by-id user-id)] ; note that in order to validate the requested new email without ; additional validation code, this is handled like if it were the real, ; current email. (when (valid? (merge user {:email new-email})) (update! user-id {:new_requested_email new-email :email_change_code (hexadecimalize (generate-secure-token 20))} {:skip-validations true}))))
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code