aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2013-01-16 00:05:18 -0800
committerAdam Soltys <[email protected]>2013-01-16 00:05:18 -0800
commit60f21d2927b5173ecbd9cccc8bbe91018029c471 (patch)
tree7bd1c9e898ec7d526870d36d8c12d95cc2ddd3fa /public
parentd78a7c4913184ad00e52839c86dc5d8b54900adf (diff)
downloadcoinos-server-60f21d2927b5173ecbd9cccc8bbe91018029c471.tar.gz
coinos-server-60f21d2927b5173ecbd9cccc8bbe91018029c471.zip
Test for username existence
Diffstat (limited to 'public')
-rw-r--r--public/js/index.coffee21
1 files changed, 21 insertions, 0 deletions
diff --git a/public/js/index.coffee b/public/js/index.coffee
index ea4f9ac3..940a5e2a 100644
--- a/public/js/index.coffee
+++ b/public/js/index.coffee
@@ -1,8 +1,29 @@
#= require jquery-1.8.2.min.js
+g = exports ? this
+
$(->
fetchExchangeRate('ask')
fetchExchangeRate('bid')
+
+ $('#username').blur(->
+ $.get(
+ "/#{$(this).val()}/exists",
+ username: $(this).val(),
+ (data) ->
+ if data is "true"
+ $('#username').prev().css('color', 'red').html('Username (taken)')
+ g.preventSubmit = true
+ else
+ $('#username').prev().css('color', 'black').html('Username')
+ g.preventSubmit = false
+ )
+ )
+
+ $('#signup').submit(->
+ return false if g.preventSubmit
+ return true
+ )
)
fetchExchangeRate = (type) ->