fix a bug with creating new accounts

This commit is contained in:
BobTheBob 2021-11-27 22:51:14 +00:00
parent b41ad5af4b
commit bad2991b5e
1 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,10 @@ module.exports = ( fastify, opts, done ) => {
let account = await accounts.AsyncGetPlayerByID( request.query.id )
if ( !account ) // create account for user
account = await accounts.AsyncCreateAccountForID( request.query.id )
{
await accounts.AsyncCreateAccountForID( request.query.id )
account = await accounts.AsyncGetPlayerByID( request.query.id )
}
let authToken = crypto.randomBytes( 16 ).toString( "hex" )
accounts.AsyncUpdateCurrentPlayerAuthToken( account.id, authToken )