From 060d0a20fa9d8e1e0c9f9cb5218ef37b46015301 Mon Sep 17 00:00:00 2001 From: sostler Date: Thu, 8 Apr 2010 05:04:06 -0400 Subject: Added case-insensitive username registration; double pw --- static/js/register.js | 91 +++------------------------------------------------ static/register.html | 7 ++-- 2 files changed, 10 insertions(+), 88 deletions(-) (limited to 'static') 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 a758e66..f7c7163 100644 --- a/static/register.html +++ b/static/register.html @@ -39,13 +39,16 @@
password - + +
+ repeat password + +

email

-


-- cgit v1.2.3-70-g09d2 From 3bc6dfdbb08028fae24b17ad07d6ccbb06e809cb Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Thu, 8 Apr 2010 05:27:40 -0400 Subject: Remove check for username caps, added tim banner --- src/site.clj | 4 +-- static/css/header.css | 6 +++++ static/img/wherestim.gif | Bin 0 -> 1702 bytes template/banner.st | 65 +++++++++++++++++++++++++---------------------- 4 files changed, 42 insertions(+), 33 deletions(-) create mode 100644 static/img/wherestim.gif (limited to 'static') diff --git a/src/site.clj b/src/site.clj index 43bbe7e..ef4e773 100755 --- a/src/site.clj +++ b/src/site.clj @@ -105,8 +105,8 @@ (not (re-matches nick-regex n)) "NICK_INVALID_CHARS")) (defn fetch-nick [nick] - (let [query "SELECT * FROM users WHERE LOWER(nick) = ? LIMIT 1"] - (first (do-select [query (s/lower-case nick)])))) + (let [query "SELECT * FROM users WHERE nick = ? LIMIT 1"] + (first (do-select [query nick])))) (defn authorize-nick-hash [nick hash] (let [db-user (fetch-nick nick)] diff --git a/static/css/header.css b/static/css/header.css index 2e6a3e6..42f4b26 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 Binary files /dev/null and b/static/img/wherestim.gif differ diff --git a/template/banner.st b/template/banner.st index 02613c6..6d99d8b 100755 --- a/template/banner.st +++ b/template/banner.st @@ -1,33 +1,34 @@ -
-
-
- -
-
- -
-
-
- $if(user_nick)$ - +
+
+ +
+
+ +
+
+ + + + $endif$ +
+ +
+
@@ -36,12 +37,14 @@
- $if(isadmin)$ - - $endif$ -
+ + + $if(isadmin)$ + + $endif$ +
$if(user_nick)$ Logout $else$ $form_login()$ $endif$
-- cgit v1.2.3-70-g09d2