Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive username #341

Merged
merged 1 commit into from
Jul 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Resolved case sensitive username bug
  • Loading branch information
inderpreetsingh committed Jul 25, 2015
commit 8cee5b877a74c35b02e13af627b0340a2cea8d60
3 changes: 1 addition & 2 deletions server/methods/getUsernameSuggestion.coffee
Original file line number Diff line number Diff line change
@@ -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 = []
5 changes: 2 additions & 3 deletions server/methods/setUsername.coffee
Original file line number Diff line number Diff line change
@@ -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?
@@ -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") }})