diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/email.clj | 16 | ||||
| -rw-r--r-- | src/site.clj | 6 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/email.clj b/src/email.clj index 2fd22e1..dbe60ea 100644 --- a/src/email.clj +++ b/src/email.clj @@ -56,14 +56,14 @@ (defn dump-mail [to subject text] (base-mail :user "info@dump.fm" - :password "dumprulez7" - :host "smtpout.secureserver.net" - :port 25 - :ssl false - :to to - :subject subject - :text text - :mime (classify-mimetype text))) + :password "UHR4Moghu5a2" + :host "smtpout.secureserver.net" + :port 25 + :ssl false + :to to + :subject subject + :text text + :mime (classify-mimetype text))) (defn send-registration-email ([nick email] (send-registration-email nick email "welcome")) diff --git a/src/site.clj b/src/site.clj index 1ecec31..fc61686 100644 --- a/src/site.clj +++ b/src/site.clj @@ -106,6 +106,10 @@ (< (count n) 3) "NICK_TOO_SHORT" (not (re-matches nick-regex n)) "NICK_INVALID_CHARS")) +(defn check-nick [nick] + (let [query "SELECT * FROM users WHERE LOWER(nick) = ? LIMIT 1"] + (> (count (do-select [query (s/lower-case nick)])) 0))) + (defn fetch-nick [nick] (let [query "SELECT * FROM users WHERE nick = ? LIMIT 1"] (first (do-select [query nick])))) @@ -387,7 +391,7 @@ hash (params :hash) invalid-nick-reason (is-invalid-nick? nick)] (cond invalid-nick-reason (resp-error invalid-nick-reason) - (fetch-nick nick) (resp-error "NICK_TAKEN") + (check-nick nick) (resp-error "NICK_TAKEN") :else (with-connection *db* (insert-values :users [:nick :hash :email] |
