Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
merge setkey hotfix into production
Browse files Browse the repository at this point in the history
  • Loading branch information
lloyd committed Aug 22, 2011
2 parents 1ea7084 + 133868a commit 95e9fc5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions browserid/lib/wsapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,16 @@ function setup(app) {
});

app.post('/wsapi/set_key', checkAuthed, checkParams(["email", "pubkey"]), function (req, resp) {
db.addKeyToEmail(req.session.authenticatedUser, req.body.email, req.body.pubkey, function (rv) {
resp.json(rv);
db.emailsBelongToSameAccount(req.session.authenticatedUser, req.body.email, function(sameAccount) {
// not same account? big fat error
if (!sameAccount) {
httputils.badRequest(resp, "that email does not belong to you");
} else {
// same account, we add the key
db.addKeyToEmail(req.session.authenticatedUser, req.body.email, req.body.pubkey, function (rv) {
resp.json(rv);
});
}
});
});

Expand Down

0 comments on commit 95e9fc5

Please sign in to comment.