user registration: fix late user save for when a user id is needed

This commit is contained in:
Alice Gaudon 2020-08-26 14:03:41 +02:00
parent 4a13e8849d
commit 38a9c6ad15

View File

@ -65,10 +65,10 @@ export default abstract class AuthGuard<P extends AuthProof<User>> {
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) {