Commit 63dcd534 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

fixed double callbacks causing ERR_HTTP_HEADERS_SENT

parent e00f0382
......@@ -60,7 +60,6 @@ var methods = {
})
});
});
callback(err)
});
callback(err)
})
......@@ -165,27 +164,29 @@ var methods = {
return null
},
verifyUserAccount: function(userData:any, callback:any) {
dbconn.user.beginTransaction(function(err:any) { // START TRANSACTION
if (err) { throw err }
// update user status
dbconn.user.query('UPDATE user SET ? WHERE id =' +userData.id, userData, function (err:any, rows:any, fields:any) {
if (err) {
return dbconn.user.rollback(function() { throw err })
}
// delete verification token
dbconn.user.query('DELETE FROM verification WHERE user_id = '+userData.id, function (err:any, rows:any, fields:any) {
dbconn.user.getConnection(function(err:any, thisconn){
thisconn.beginTransaction(function(err:any) { // START TRANSACTION
if (err) { throw err }
// update user status
thisconn.query('UPDATE user SET ? WHERE id =' +userData.id, userData, function (err:any, rows:any, fields:any) {
if (err) {
return dbconn.user.rollback(function() { throw err })
return thisconn.rollback(function() { throw err })
}
// COMMIT
dbconn.user.commit(function(err:any) {
// delete verification token
thisconn.query('DELETE FROM verification WHERE user_id = '+userData.id, function (err:any, rows:any, fields:any) {
if (err) {
return dbconn.user.rollback(function() { throw err })
return thisconn.rollback(function() { throw err })
}
// COMMIT
thisconn.commit(function(err:any) {
if (err) {
return thisconn.rollback(function() { throw err })
}
})
})
})
})
callback(err)
callback(err)
})
},
/* ===== GitLab ===== */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment