From 38a9c6ad15e6d99f2a98aed8ab5693cb3d230303 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 26 Aug 2020 14:03:41 +0200 Subject: [PATCH] user registration: fix late user save for when a user id is needed --- src/auth/AuthGuard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auth/AuthGuard.ts b/src/auth/AuthGuard.ts index 5a0d380..e43dd57 100644 --- a/src/auth/AuthGuard.ts +++ b/src/auth/AuthGuard.ts @@ -65,10 +65,10 @@ export default abstract class AuthGuard

> { await MysqlConnectionManager.wrapTransaction(async connection => { user = User.create({}); + await user.save(connection, c => callbacks.push(c)); if (onRegister) { (await onRegister(connection, user)).forEach(c => callbacks.push(c)); } - await user.save(connection, c => callbacks.push(c)); }); for (const callback of callbacks) {