From ed4a64c60d96ed2ba377a73201c43b558b7f915b Mon Sep 17 00:00:00 2001
From: Adam Soltys
Date: Tue, 11 Dec 2012 21:47:38 -0800
Subject: Open registration, tweak directory CSS
---
app.coffee | 6 +--
public/css/index.less | 3 +-
routes/sessions.coffee | 4 +-
routes/users.coffee | 20 ++++---
views/main/about.html | 36 ++++++-------
views/main/exchangers.html | 131 +++++++++++++++++++++++----------------------
views/main/merchants.html | 40 +++++++-------
7 files changed, 125 insertions(+), 115 deletions(-)
diff --git a/app.coffee b/app.coffee
index add2f017..5a7a6ce0 100644
--- a/app.coffee
+++ b/app.coffee
@@ -6,7 +6,7 @@ passport = require('./passport')
calculator = require("./routes/calculator")
sessions = require("./routes/sessions")(passport)
transactions = require("./routes/transactions")
-users = require("./routes/users")
+users = require("./routes/users")(sessions)
RedisStore = require('connect-redis')(express)
sessionStore = new RedisStore(ttl: 172800)
@@ -62,8 +62,8 @@ app.get('/logout', sessions.destroy)
app.get('/:user.json', authorize, users.json)
app.get('/:user', authorize, users.show)
-app.get('/users/new', authorize, users.new)
-app.post('/users', authorize, users.create)
+app.get('/users/new', users.new)
+app.post('/users', users.create)
app.get('/:user/edit', authorize, users.edit)
app.post('/:user/update', authorize, users.update)
diff --git a/public/css/index.less b/public/css/index.less
index 5a3e5862..3cdcca76 100644
--- a/public/css/index.less
+++ b/public/css/index.less
@@ -16,7 +16,8 @@ footer {
}
#ask, #bid { color: white; }
-div.directory img { width: 150px; height: 150px; float: left; padding-right: 5px; }
+div.directory { width: 500px; float: left; border: 1px dashed #ccc; padding: 10px; margin: 10px; }
+div.directory img { width: 150px; height: 150px; float: left; padding-right: 10px; }
div.directory p { font-size: 13px; }
div.directory h2 a { text-decoration: none; color: #000; }
div.row-fluid td.first { text-align: right; }
diff --git a/routes/sessions.coffee b/routes/sessions.coffee
index 50719394..70c18b4e 100644
--- a/routes/sessions.coffee
+++ b/routes/sessions.coffee
@@ -14,7 +14,9 @@ module.exports = (passport) ->
req.login(user, (err) ->
if (err)
return next(err)
- return res.redirect('/' + user.username)
+ url = req.headers['referer']
+ url = "/#{user.username}" unless /edit/.test(url)
+ return res.redirect(url)
)
)(req, res, next)
diff --git a/routes/users.coffee b/routes/users.coffee
index ea927583..d312dcf5 100644
--- a/routes/users.coffee
+++ b/routes/users.coffee
@@ -1,7 +1,7 @@
db = require("redis").createClient()
bcrypt = require('bcrypt')
-module.exports =
+module.exports = (sessions) ->
json: (req, res) ->
db.hgetall(req.params.user, (err, obj) ->
delete obj['password']
@@ -23,11 +23,19 @@ module.exports =
)
create: (req, res) ->
- bcrypt.hash(req.body.password, 12, (err, hash) ->
- req.body.password = hash
- db.hmset(req.body.username, req.body, ->
- res.redirect(req.body.username)
- )
+ db.hgetall(req.body.username, (err, obj) ->
+ if obj
+ res.redirect(req.body.username)
+ else
+ bcrypt.hash(req.body.password, 12, (err, hash) ->
+ db.hmset(
+ req.body.username,
+ {username: req.body.username, password: hash},
+ ->
+ req.headers['referer'] = "/#{req.body.username}/edit"
+ sessions.create(req, res)
+ )
+ )
)
edit: (req, res) ->
diff --git a/views/main/about.html b/views/main/about.html
index fa8503a0..2c644b5f 100644
--- a/views/main/about.html
+++ b/views/main/about.html
@@ -7,13 +7,13 @@
They get sent to a bitcoin address and stored in a digital wallet
that you can access with a
password. Creating a wallet is free and
- easy. Try it here at our favourite e-Wallet provider.
+ easy -- try it.
- New addresses start with a zero balance. Transactions between addresses are
- recorded in a public file and published on
- the Internet. The file has a record of every transaction that's taken place since Bitcoin started in 2009 and is used to determine the current balance of every address.
+ New bitcoin addresses start with a zero balance. Transactions between addresses are
+ recorded in a file that gets published on
+ the Internet. The file keeps track of every transaction that's ever taken place on the bitcoin network and is used to determine the current balance of every address.
@@ -28,7 +28,7 @@
bitcoins will be created until finally there are a total of
21 million of them in circulation by the year 2040. Each one of them
is divisible up to 8 decimal places, making
- it possible to transact very small amounts.
+ it possible to transact small amounts.
@@ -51,12 +51,12 @@
immediate payments to your friends and family
from your phone or laptop so you can pay a co-worker
back for coffee, transfer wages to family overseas,
- or donate to organizations like WikiLeaks who have
- been cut off by the major payment companies. Or, use them to
- backup your savings and gain access to them
+ or donate to organizations like WikiLeaks who've
+ been cut off by the major payment companies. Or, use bitcoins to securely
+ store your savings and gain access to them
from anywhere that has Internet access. They tend to
appreciate in value over time because of their
- limited supply so they make a good investment.
+ limited supply, so they make a good investment.
Unlike dollars and other national currencies, no
government or issuing authority can print more of
them.
@@ -98,15 +98,9 @@
Bitcoins aren't backed by any underlying
commodity or insured by any authority. They
- have value as a form of currency due to their mathematically
- guaranteed scarcity, security, ease of use,
- distributed nature, lack of fees, divisibility, and
- global recognition.
-
-
-
- We peg our rates
- to cavirtex.com.
+ have value as a currency due to their mathematically
+ guaranteed scarcity, security, divisibility,
+ and global recognition.
@@ -116,15 +110,15 @@
What can I buy with them?
You can spend them locally at one of our participating merchants or check out
- this article for some other good suggestions.
+ this article for some other suggestions.
The number of companies accepting bitcoins
is growing quickly and we're working to get more stores accepting them in
Vancouver. We believe it'll be in
their best interest to avoid the transaction fees
charged by the credit card companies. Transaction
fees end up getting built into the prices we pay for
- goods and services across the board so we're all
- paying for them indirectly.
+ goods and services across the board so we're always
+ subsidizing the banks and payment companies.
diff --git a/views/main/exchangers.html b/views/main/exchangers.html
index fbe6a77f..345c4096 100644
--- a/views/main/exchangers.html
+++ b/views/main/exchangers.html
@@ -1,4 +1,4 @@
-
+
Exchangers
@@ -14,75 +14,78 @@
Contact one of us to let us know your availability and how much you want to spend
We'll arrange a time to meet at a public place like a café or a bank
At the time of meeting, we'll look up the exchange rate above to determine how many bitcoins to send for the amount specified
- You'll provide us with a bitcoin address to send to and count out the cash for us
+ You'll provide us with a bitcoin address to send to and count out the cash
We'll send the bitcoins to your address using a phone or laptop
- When the transaction is confirmed, we take the cash and you keep the bitcoins!
+ When the transaction is confirmed, we take the cash, you keep the bitcoins!
-
-
Adam
-

-
-
- | Neighbourhood: |
- Hastings/Sunrise |
-
-
- | Phone: |
- 604-358-6745 |
-
-
- | Email: |
- asoltys@gmail.com |
-
-
- | LocalBitcoins: |
- asoltys |
-
-
-
-
-
Jackson
-

-
-
-
-
Yuri
-

-
+
+
+
Adam
+

+
+
+ | Neighbourhood: |
+ Hastings/Sunrise |
+
+
+ | Phone: |
+ 604-358-6745 |
+
+
+ | Email: |
+ asoltys@gmail.com |
+
+
+ | LocalBitcoins: |
+ asoltys |
+
+
+
+
+
+
Jackson
+

+
+
+
+
Yuri
+

+
+
diff --git a/views/main/merchants.html b/views/main/merchants.html
index d8aafaa9..b8a8c614 100644
--- a/views/main/merchants.html
+++ b/views/main/merchants.html
@@ -1,4 +1,4 @@
-
+
Merchants
@@ -10,26 +10,28 @@
-
-
-

-
- Vancouver's most blissful massage and integrated healing center. We specialize in Swedish relaxation massage and Hot & Cold Stone Therapy. Treatments can be scheduled at Infinity Salon & Spa and in the summer months at Vancouver's most beautiful location - Wreck Beach!
-
-
+
+
+
+

+
+ Vancouver's most blissful massage and integrated healing center. We specialize in Swedish relaxation massage and Hot & Cold Stone Therapy. Treatments can be scheduled at Infinity Salon & Spa and in the summer months at Vancouver's most beautiful location - Wreck Beach!
+
+
-
-
-

-
- Everything from cinnamon buns made from grandma’s recipe, famous home style Pad Thai and homemade soup to Italian specialty coffee drinks, all made right in front of you
-
-
+
+
+

+
+ Everything from cinnamon buns made from grandma’s recipe, famous home style Pad Thai and homemade soup to Italian specialty coffee drinks, all made right in front of you
+
+
-
-
Divan Kitchen
-

-
Authentic Turkish kebab and desserts
+
+
Divan Kitchen
+

+
Authentic Turkish kebab and desserts
+
--
cgit v1.2.3