Skip to content

Commit

Permalink
fix(username): set lowerCaseUsername field
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreCat committed Oct 11, 2018
1 parent 49e940e commit 8b38fd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion website/server/middlewares/auth.js
Expand Up @@ -67,7 +67,9 @@ export function authWithHeaders (options = {}) {
if (!user) throw new NotAuthorized(res.t('invalidCredentials'));
if (user.auth.blocked) throw new NotAuthorized(res.t('accountSuspended', {communityManagerEmail: COMMUNITY_MANAGER_EMAIL, userId: user._id}));
if (!user.auth.local.username) {
user.auth.local.username = generateUsername();
const generatedUsername = generateUsername();
user.auth.local.username = generatedUsername;
user.auth.local.lowerCaseUsername = generatedUsername;
await user.save();
}

Expand Down

0 comments on commit 8b38fd3

Please sign in to comment.