diff options
| -rw-r--r-- | bower.json | 5 | ||||
| -rw-r--r-- | public/js/profile.coffee | 1 | ||||
| -rw-r--r-- | public/js/profile.js | 6 | ||||
| -rw-r--r-- | routes/users.js | 6 | ||||
| -rw-r--r-- | src/routes/users.coffee | 8 | ||||
| -rw-r--r-- | views/users/profile.html | 6 |
6 files changed, 21 insertions, 11 deletions
@@ -3,7 +3,7 @@ "description": "Bitcoin Point of Sale App", "main": "app.js", "authors": [ - "Adam Soltys <[email protected]>" + "Adam Soltys <[email protected]>" ], "license": "MIT", "keywords": [ @@ -34,7 +34,8 @@ "jquery-serialize-object": "~2.5.0", "crypto-js": "~3.1.5", "bootbox.js": "bootbox#~4.4.0", - "moment": "^2.15.1" + "moment": "^2.15.1", + "bootstrap-formhelpers": "^2.3.0" }, "resolutions": { "bootstrap": "b962f8a4308d094c23c9ac47a0a5ee3d4e9a4bfd" diff --git a/public/js/profile.coffee b/public/js/profile.coffee index fdbde8ee..a894f275 100644 --- a/public/js/profile.coffee +++ b/public/js/profile.coffee @@ -8,6 +8,7 @@ $(-> user = $('#username').val() $.getJSON("/#{user}.json", (data) -> $('#email').val(data.email) + $('#phone').val(data.phone) $('#profile').fadeIn() ) diff --git a/public/js/profile.js b/public/js/profile.js index a49c7583..db81832b 100644 --- a/public/js/profile.js +++ b/public/js/profile.js @@ -1,4 +1,3 @@ -;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){ (function() { var g; @@ -13,6 +12,7 @@ user = $('#username').val(); $.getJSON("/" + user + ".json", function(data) { $('#email').val(data.email); + $('#phone').val(data.phone); return $('#profile').fadeIn(); }); $('#confirm').blur(function() { @@ -34,7 +34,3 @@ }); }).call(this); - - -},{}]},{},[1]) -;
\ No newline at end of file diff --git a/routes/users.js b/routes/users.js index 315287e2..56db583d 100644 --- a/routes/users.js +++ b/routes/users.js @@ -232,9 +232,11 @@ req.session.user = req.body; delete req.session.user.password; if (req.body.password != null) { - return bcrypt.hash(req.body.password, 12, function(err, hash) { + return bcrypt.hash(req.body.password, 12, function(err, password) { return db.hmset("user:" + (req.params.user.toLowerCase()), { - password: hash + email: email, + password: password, + phone: phone }, function() { if (req.xhr) { res.send({}); diff --git a/src/routes/users.coffee b/src/routes/users.coffee index cff87d62..7b2f1f3a 100644 --- a/src/routes/users.coffee +++ b/src/routes/users.coffee @@ -179,8 +179,12 @@ module.exports = (sessions) -> delete req.session.user.password if req.body.password? - bcrypt.hash(req.body.password, 12, (err, hash) -> - db.hmset("user:#{req.params.user.toLowerCase()}", password: hash, -> + bcrypt.hash(req.body.password, 12, (err, password) -> + db.hmset("user:#{req.params.user.toLowerCase()}", + email: email + password: password + phone: phone + , -> if req.xhr res.send({}) res.end() diff --git a/views/users/profile.html b/views/users/profile.html index 0f37d20e..060ff240 100644 --- a/views/users/profile.html +++ b/views/users/profile.html @@ -1,4 +1,5 @@ {{#yield-scripts}} +<script src="/bower/bootstrap-formhelpers/dist/js/bootstrap-formhelpers.min.js"></script> <script src="/js/profile.js"></script> {{/yield-scripts}} @@ -13,6 +14,11 @@ </div> <div class="form-group"> + <label for="phone">Phone:</label> + <input type="text" id="phone" name="phone" class="form-control bfh-phone" data-format="+1 (ddd) ddd-dddd" /> + </div> + + <div class="form-group"> <label for="password">New Password <small>(blank = no change)</small>:</label> <input type="password" id="password" name="password" class="form-control" /> </div> |
