diff options
| author | Adam Soltys <[email protected]> | 2013-01-16 00:05:18 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2013-01-16 00:05:18 -0800 |
| commit | 60f21d2927b5173ecbd9cccc8bbe91018029c471 (patch) | |
| tree | 7bd1c9e898ec7d526870d36d8c12d95cc2ddd3fa /public | |
| parent | d78a7c4913184ad00e52839c86dc5d8b54900adf (diff) | |
| download | coinos-server-60f21d2927b5173ecbd9cccc8bbe91018029c471.tar.gz coinos-server-60f21d2927b5173ecbd9cccc8bbe91018029c471.zip | |
Test for username existence
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/index.coffee | 21 |
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) -> |
