Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fixes #5210 - Register account with device when fxa logged in before …
Browse files Browse the repository at this point in the history
…first upload
  • Loading branch information
punamdahiya committed Nov 21, 2018
1 parent 6ed92b6 commit 5128c53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ app.post("/api/register", function(req, res) {
simpleResponse(res, "Bad request, no secret", 400);
return;
}
registerLogin(vars.deviceId, {
registerLogin(vars.deviceId, req.accountId, {
secret: vars.secret,
nickname: vars.nickname || null,
avatarurl: vars.avatarurl || null,
Expand Down
8 changes: 4 additions & 4 deletions server/src/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ exports.checkLogin = function(deviceId, secret, addonVersion) {
});
};

exports.registerLogin = function(deviceId, data, canUpdate) {
exports.registerLogin = function(deviceId, accountId, data, canUpdate) {
if (!deviceId) {
throw new Error("No deviceId given");
}
Expand All @@ -102,9 +102,9 @@ exports.registerLogin = function(deviceId, data, canUpdate) {
}
const secretHashed = createHash(data.secret);
return db.insert(
`INSERT INTO devices (id, secret_hashed)
VALUES ($1, $2)`,
[deviceId, secretHashed || null]
`INSERT INTO devices (id, secret_hashed, accountid)
VALUES ($1, $2, $3)`,
[deviceId, secretHashed || null, accountId || null]
).then((inserted) => {
const userAbTests = abTests.updateAbTests({}, getForceAbTests());
if (inserted) {
Expand Down

0 comments on commit 5128c53

Please sign in to comment.