Merge pull request #2720 from whowillcare/master

if username contains space, @ functions will fail at certain point
This commit is contained in:
Lauri Ojansivu 2019-09-25 20:51:51 +03:00 committed by GitHub
commit 814e264521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 27 deletions

View file

@ -561,6 +561,7 @@ Users.mutations({
Meteor.methods({
setUsername(username, userId) {
check(username, String);
check(userId, String);
const nUsersWithUsername = Users.find({ username }).count();
if (nUsersWithUsername > 0) {
throw new Meteor.Error('username-already-taken');