Compare commits

...

2 commits

Author SHA1 Message Date
oat
4cbe252852
now no two users can have the same uuid 2020-10-12 21:13:45 +03:00
oat
0a150ad343
one more auth fix 2020-10-12 20:56:06 +03:00

View file

@ -33,10 +33,16 @@ export function run(app) {
}
});
const users = await User.find({id: userInfo.id});
const users = await User.find({id: String(userInfo.data.id)});
let userUuid = '';
if (users.length === 0) {
let newUuid = uuid.v4();
while (User.find({uuid: newUuid})[0]) {
newUuid = uuid.v4();
}
const newUser = new User({
id: String(userInfo.data.id),
createdAt: new Date(),
@ -45,7 +51,7 @@ export function run(app) {
discriminator: userInfo.data.discriminator,
avatar: userInfo.data.avatar,
uuid: uuid.v4(),
uuid: newUuid,
});
userUuid = newUser.get('uuid');