diff options
| -rw-r--r-- | app.coffee | 6 | ||||
| -rw-r--r-- | public/css/index.less | 3 | ||||
| -rw-r--r-- | routes/sessions.coffee | 4 | ||||
| -rw-r--r-- | routes/users.coffee | 20 | ||||
| -rw-r--r-- | views/main/about.html | 36 | ||||
| -rw-r--r-- | views/main/exchangers.html | 131 | ||||
| -rw-r--r-- | views/main/merchants.html | 40 |
7 files changed, 125 insertions, 115 deletions
@@ -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. <a href="https://blockchain.info/wallet/new" target="_blank">Try it here</a> at our favourite e-Wallet provider. + easy -- <a href="https://blockchain.info/wallet/new" target="_blank">try it</a>. </p> <p> - New addresses start with a zero balance. Transactions between addresses are - recorded in a public file and <a href="http://blockchain.info/unconfirmed-transactions">published on - the Internet</a>. 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. </p> <p> @@ -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. </p> </div> <div class="span6"> @@ -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 @@ <p> 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. - </p> - - <p> - We peg our rates - to <a href="http://cavirtex.com/">cavirtex.com</a>. + have value as a currency due to their mathematically + guaranteed scarcity, security, divisibility, + and global recognition. </p> </div> </div> @@ -116,15 +110,15 @@ <h1>What can I buy with them?</h1> <p> You can <a href="/merchants">spend them locally</a> at one of our participating merchants or check out - <a href="http://bitcoinmagazine.net/where-to-spend-your-bitcoins/">this article</a> for some other good suggestions. + <a href="http://bitcoinmagazine.net/where-to-spend-your-bitcoins/">this article</a> for some other suggestions. The number of <a href="https://en.bitcoin.it/wiki/Trade">companies accepting bitcoins</a> 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. </p> </div> 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 @@ -<div class="container-fluid directory"> +<div class="container-fluid"> <div class="row-fluid"> <div class="span6"> <h1>Exchangers</h1> @@ -14,75 +14,78 @@ <li>Contact one of us to let us know your availability and how much you want to spend</li> <li>We'll arrange a time to meet at a public place like a café or a bank</li> <li>At the time of meeting, we'll look up the exchange rate above to determine how many bitcoins to send for the amount specified</li> - <li>You'll provide us with a bitcoin address to send to and count out the cash for us</li> + <li>You'll provide us with a bitcoin address to send to and count out the cash</li> <li>We'll send the bitcoins to your address using a phone or laptop</li> - <li>When the transaction is confirmed, we take the cash and you keep the bitcoins!</li> + <li>When the transaction is confirmed, we take the cash, you keep the bitcoins!</li> </ul> </div> </div> <div class="row-fluid"> - <div class="span4"> - <h2>Adam</h2> - <a href="https://localbitcoins.com/accounts/profile/asoltys/"><img src="img/adam.jpg" alt="Adam" /></a> - <table> - <tr> - <td class="first"><b>Neighbourhood:</b></td> - <td>Hastings/Sunrise</td> - </tr> - <tr> - <td class="first"><b>Phone:</b></td> - <td>604-358-6745</td> - </tr> - <tr> - <td class="first"><b>Email:</b></td> - <td><a href="mailto:[email protected]">[email protected]</a></td> - </tr> - <tr> - <td class="first"><b>LocalBitcoins:</b></td> - <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/asoltys/">asoltys</a></td> - </tr> - </table> - </div> - <div class="span4"> - <h2>Jackson</h2> - <a href="https://localbitcoins.com/accounts/profile/stretchwynand/"><img src="img/jackson.jpg" alt="Jackson" /></a> - <table> - <tr> - <td class="first"><b>Neighbourhood:</b></td> - <td>Fairview</td> - </tr> - <tr> - <td class="first"><b>Phone:</b></td> - <td>604-358-6745</td> - </tr> - <tr> - <td class="first"><b>Email:</b></td> - <td><a href="mailto:[email protected]">[email protected]</a></td> - </tr> - <tr> - <td class="first"><b>LocalBitcoins:</b></td> - <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/stretchwynand/">stretchwynand</a></td> - </tr> - </table> - </div> - <div class="span4"> - <h2>Yuri</h2> - <a href="https://localbitcoins.com/accounts/profile/beeteecee/"><img src="img/yuri.jpg" alt="Yuri" /></a> - <table> - <tr> - <td class="first"><b>Neighbourhood:</b></td> - <td>West End</td> - </tr> - <tr> - <td class="first"><b>Website:</b></td> - <td><a href="http://beeteecee.com/" target="_blank">beeteecee.com</a></td> - </tr> - <tr> - <td class="first"><b>LocalBitcoins:</b></td> - <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/beeteecee/">beeteecee</a></td> - </tr> - </table> + <div class="span12"> + <div class="directory"> + <h2>Adam</h2> + <a href="https://localbitcoins.com/accounts/profile/asoltys/"><img src="img/adam.jpg" alt="Adam" /></a> + <table> + <tr> + <td class="first"><b>Neighbourhood:</b></td> + <td>Hastings/Sunrise</td> + </tr> + <tr> + <td class="first"><b>Phone:</b></td> + <td>604-358-6745</td> + </tr> + <tr> + <td class="first"><b>Email:</b></td> + <td><a href="mailto:[email protected]">[email protected]</a></td> + </tr> + <tr> + <td class="first"><b>LocalBitcoins:</b></td> + <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/asoltys/">asoltys</a></td> + </tr> + </table> + </div> + + <div class="directory"> + <h2>Jackson</h2> + <a href="https://localbitcoins.com/accounts/profile/stretchwynand/"><img src="img/jackson.jpg" alt="Jackson" /></a> + <table> + <tr> + <td class="first"><b>Neighbourhood:</b></td> + <td>Fairview</td> + </tr> + <tr> + <td class="first"><b>Phone:</b></td> + <td>604-358-6745</td> + </tr> + <tr> + <td class="first"><b>Email:</b></td> + <td><a href="mailto:[email protected]">[email protected]</a></td> + </tr> + <tr> + <td class="first"><b>LocalBitcoins:</b></td> + <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/stretchwynand/">stretchwynand</a></td> + </tr> + </table> + </div> + <div class="directory"> + <h2>Yuri</h2> + <a class="img" href="https://localbitcoins.com/accounts/profile/beeteecee/"><img src="img/yuri.jpg" alt="Yuri" /></a> + <table> + <tr> + <td class="first"><b>Neighbourhood:</b></td> + <td>West End</td> + </tr> + <tr> + <td class="first"><b>Website:</b></td> + <td><a href="http://beeteecee.com/" target="_blank">beeteecee.com</a></td> + </tr> + <tr> + <td class="first"><b>LocalBitcoins:</b></td> + <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/beeteecee/">beeteecee</a></td> + </tr> + </table> + </div> </div> </div> </div> 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 @@ -<div class="container-fluid directory"> +<div class="container-fluid"> <div class="row-fluid"> <div class="span6"> <h1>Merchants</h1> @@ -10,26 +10,28 @@ </div> <div class="row-fluid"> - <div class="span4"> - <h2><a href="http://pacificblissmassage.com/">Pacific Bliss Massage</a></h2> - <a href="http://pacificblissmassage.com/"><img src="http://pacificblissmassage.com/VancouverCustomizedMassage.jpg" alt="Pacific Bliss" /></a> - <p style="overflow: hidden"> - 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! - </p> - </div> + <div class="span12"> + <div class="directory"> + <h2><a href="http://pacificblissmassage.com/">Pacific Bliss Massage</a></h2> + <a href="http://pacificblissmassage.com/"><img src="http://pacificblissmassage.com/VancouverCustomizedMassage.jpg" alt="Pacific Bliss" /></a> + <p style="overflow: hidden"> + 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! + </p> + </div> - <div class="span4"> - <h2><a href="http://www.sweettoothcafe.ca/">Sweet Tooth Cafe</a></h2> - <a href="http://www.sweettoothcafe.ca/"><img src="http://www.sweettoothcafe.ca/_/rsrc/1301203218770/config/customLogo.gif?revision=8" alt="Sweet Tooth Cafe" /></a> - <p> - 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 - </p> - </div> + <div class="directory"> + <h2><a href="http://www.sweettoothcafe.ca/">Sweet Tooth Cafe</a></h2> + <a href="http://www.sweettoothcafe.ca/"><img src="http://www.sweettoothcafe.ca/_/rsrc/1301203218770/config/customLogo.gif?revision=8" alt="Sweet Tooth Cafe" /></a> + <p> + 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 + </p> + </div> - <div class="span4"> - <h2>Divan Kitchen</h2> - <img src="http://sphotos-g.ak.fbcdn.net/hphotos-ak-prn1/150071_116421141753535_3214357_n.jpg" /> - <p>Authentic Turkish kebab and desserts</p> + <div class="directory"> + <h2>Divan Kitchen</h2> + <img src="http://sphotos-g.ak.fbcdn.net/hphotos-ak-prn1/150071_116421141753535_3214357_n.jpg" /> + <p>Authentic Turkish kebab and desserts</p> + </div> </div> </div> </div> |
