Skip to content

Commit

Permalink
Merge pull request #341 from inderpreetsingh/username-bug
Browse files Browse the repository at this point in the history
Case insensitive username
  • Loading branch information
marceloschmidt committed Jul 25, 2015
2 parents cbfa52c + 8cee5b8 commit dcfcda1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions server/methods/getUsernameSuggestion.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ slug = (text) ->
usernameIsAvaliable = (username) ->
if username.length < 1
return false

return not Meteor.users.findOne({username: username})?
return not Meteor.users.findOne({username: {$regex : new RegExp(username, "i") }})

@generateSuggestion = (user) ->
usernames = []
Expand Down
5 changes: 2 additions & 3 deletions server/methods/setUsername.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Meteor.methods
if not usernameIsAvaliable username
throw new Meteor.Error 'username-unavaliable'

if not /^[0-9a-z-_.]+$/.test username
if not /^[0-9a-zA-Z-_.]+$/.test username
throw new Meteor.Error 'username-invalid'

if not user.username?
Expand Down Expand Up @@ -58,5 +58,4 @@ slug = (text) ->
usernameIsAvaliable = (username) ->
if username.length < 1
return false

return not Meteor.users.findOne({username: username})?
return not Meteor.users.findOne({username: {$regex : new RegExp(username, "i") }})

0 comments on commit dcfcda1

Please sign in to comment.