diff --git a/functions/methods.ts b/functions/methods.ts index 79416aee081ec6e8d79da6ad420de1bc73dc4563..f6a4eb5972d88f3102a138a05660dc477e6cd473 100644 --- a/functions/methods.ts +++ b/functions/methods.ts @@ -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 ===== */