summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortimb <timb@mb.local>2010-04-09 19:16:50 -0700
committertimb <timb@mb.local>2010-04-09 19:16:50 -0700
commit99c8ae25e4bc2b095f956fdc7a90f66c55014e02 (patch)
treefc4a099b2679e4afc3700fe6683f528c2af062a8
parent362e6c8760711626da079611aa457aa00ce4b5b7 (diff)
parent956291711de6afb17137160a67ac710be0ace1e1 (diff)
Merge branch 'master' of ssh://dump.fm/pichat/repo
-rw-r--r--src/email.clj16
-rw-r--r--src/site.clj6
-rwxr-xr-xstatic/css/header.css6
-rw-r--r--static/img/wherestim.gifbin0 -> 1702 bytes
-rwxr-xr-xstatic/js/register.js91
-rw-r--r--static/register.html7
-rw-r--r--template/banner.st65
7 files changed, 63 insertions, 128 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]
diff --git a/static/css/header.css b/static/css/header.css
index b56b73e..1aef0fe 100755
--- a/static/css/header.css
+++ b/static/css/header.css
@@ -34,6 +34,12 @@ margin-right:80%;
color: #fff;
}
+#wherestim{
+position:absolute;
+top:-10;
+left:390;
+}
+
#header7{
background-image:url(/static/img/dblue2.png);
background-attachment:inherit;
diff --git a/static/img/wherestim.gif b/static/img/wherestim.gif
new file mode 100644
index 0000000..011bbdc
--- /dev/null
+++ b/static/img/wherestim.gif
Binary files differ
diff --git a/static/js/register.js b/static/js/register.js
index 31d32e5..30e221f 100755
--- a/static/js/register.js
+++ b/static/js/register.js
@@ -1,94 +1,24 @@
-function validateNick(n) {
- if (n.length <= 2) {
- return "BAD_NICK_LENGTH";
- }
-}
-
-
-function submitRegistration() {
- var nick = $('#nickInput').val();
- var email = $('#emailInput').val();
- var password = $('#passwordInput').val() || "";function validateNick(n) {
- if (n.length <= 2) {
- return "BAD_NICK_LENGTH";
- }
-}
-
-
function submitRegistration() {
var nick = $('#nickInput').val();
var email = $('#emailInput').val();
var password = $('#passwordInput').val() || "";
-
+ var password2 = $('#passwordInput2').val() || "";
if (nick.length < 3 || nick.length > 12) {
alert("Nicks must be between 3 and 12 characters long.");
return;
- } else if (password.length < 5) {
- alert("Password must be at least 5 characters long.");
- return;
}
-
-
- var hash = hex_sha1(nick + '$' + password + '$dumpfm');
- var onSuccess = function() {
- if (typeof pageTracker !== 'undefined') {
- pageTracker._trackEvent('User', 'Register', nick);
- }
- location.href = "/";
- };
-
- var onError = function(resp) {
- var respText = resp.responseText ? resp.responseText.trim() : false;
- if (respText == 'NICK_TAKEN') {
- alert("That nick is already taken! Please choose another.");
- } else if (respText == 'NICK_INVALID_CHARS') {
- alert("Nicks can only contain letters and numbers.");
- } else {
- alert("Unable to register!");
- }
- };
-
- $.ajax({
- type: 'POST',
- timeout: 5000,
- url: 'submit-registration',
- data: {'nick': nick, 'email': email, 'hash': hash },
- cache: false,
- dataType: 'json',
- success: onSuccess,
- error: onError
-
- });
-}
-
-function initRegister() {
- $('#submit').click(submitRegistration);
-}
-
-function handleMsgError(resp) {
- var respText = resp.responseText ? resp.responseText.trim() : false;
- if (respText == 'UNKNOWN_USER') {
- alert("Can't send message! Please login.");
- } else if (respText) {
- alert("Cannot send message! (" + respText + ")");
- } else {
- alert("Cannot send message!");
+ if (password != password2) {
+ alert("Passwords must match!");
+ return;
}
-}
-
- if (nick.length < 3 || nick.length > 12) {
- alert("Nicks must be between 3 and 12 characters long.");
- return;
- } else if (password.length < 5) {
+ if (password.length < 5) {
alert("Password must be at least 5 characters long.");
return;
}
-
-
var hash = hex_sha1(nick + '$' + password + '$dumpfm');
var onSuccess = function() {
if (typeof pageTracker !== 'undefined') {
@@ -123,15 +53,4 @@ function handleMsgError(resp) {
function initRegister() {
$('#submit').click(submitRegistration);
-}
-
-function handleMsgError(resp) {
- var respText = resp.responseText ? resp.responseText.trim() : false;
- if (respText == 'UNKNOWN_USER') {
- alert("Can't send message! Please login.");
- } else if (respText) {
- alert("Cannot send message! (" + respText + ")");
- } else {
- alert("Cannot send message!");
- }
} \ No newline at end of file
diff --git a/static/register.html b/static/register.html
index bbc124d..45fcde7 100644
--- a/static/register.html
+++ b/static/register.html
@@ -39,13 +39,16 @@
<br />
<span>password</span>
- <input type="password"class="field" id="passwordInput" />
+ <input type="password" class="field" id="passwordInput" />
+ <br />
+ <span>repeat password</span>
+ <input type="password" class="field" id="passwordInput2" />
+
</h1>
<h1><span>email</span>
<input type="text" class="field"id="emailInput" />
</h1>
-
<h1><br />
diff --git a/template/banner.st b/template/banner.st
index 02613c6..6d99d8b 100644
--- a/template/banner.st
+++ b/template/banner.st
@@ -1,33 +1,34 @@
-
<div id="rapper7">
<div id="header7">
- <div id="logoicons">
- <div id="logo7">
- <div align="center"><a href="/">dump.fm</a></div>
- </div>
- <div class="white">
-
- <div id="bar7">
- <div style="float: left;">
- <div align="center">
- $if(user_nick)$
-
+ <div id="logoicons">
+ <div id="logo7">
+ <div align="center"><a href="/">dump.fm</a></div>
+ </div>
+ <div class="white">
+
+ <div id="bar7">
+ <div style="float: left;">
+ <div align="center">
+ $if(user_nick)$
- <a href="/log" ><img src="/static/img/log.gif"width="20px" height="20px"> Log</a>
- <a href="/u/$user_nick$">$if(user_avatar)$<img src="$user_avatar$" width="19px" height="19px" />$else$<img src="/static/img/profile.gif"width="22px" height="22px" />$endif$ Profile</a>
- <a href="/directory"><img src="/static/img/directory.gif"width="20px" height="20px" /> Directory</a>
- <a href="/browser"><img src="/static/img/image_draw.gif"/> Image Search</a>
-
- $else$
-
-<div id="registerlink">
-<a href="/register"><img src="/static/img/ako.gif"width="21px" height="21px" /> Register</a>
-</div>
+ <a href="/log" ><img src="/static/img/log.gif"width="20px" height="20px"> Log</a>
+ <a href="/u/$user_nick$">$if(user_avatar)$<img src="$user_avatar$" width="19px" height="19px" />$else$<img src="/static/img/profile.gif"width="22px" height="22px" />$endif$ Profile</a>
+ <a href="/directory"><img src="/static/img/directory.gif"width="20px" height="20px" /> Directory</a>
+ <a href="/browser"><img src="/static/img/image_draw.gif"/> Image Search</a>
+
+ $else$
+
-
- $endif$
- </div>
+ <div id="registerlink">
+ <a href="/register"><img src="/static/img/ako.gif"width="21px" height="21px" /> Register</a>
+ </div>
+
+ $endif$
+ <div id="wherestim">
+ <img src="/static/img/wherestim.gif">
+ </div>
+ </div>
</div>
</div>
</div>
@@ -36,12 +37,14 @@
<div id="topic"></div>
- $if(isadmin)$
- <div id="vippp">
- <a href="/VIP/chat"> &#x2605; VIP &#x2605; </a>
- </div>
- $endif$
- <div id="logout7" class="white">
+
+
+ $if(isadmin)$
+ <div id="vippp">
+ <a href="/VIP/chat"> &#x2605; VIP &#x2605; </a>
+ </div>
+ $endif$
+ <div id="logout7" class="white">
<div align="center">$if(user_nick)$ <a href="/logout"><img src="/static/img/door.gif" width="16" height="16" /> Logout</a> $else$ $form_login()$ $endif$
</div>