Skip to content
Snippets Groups Projects
Commit 47778840 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Fixed error: when allow change username was set to false, registration failed.

parent 9b4f872d
No related branches found
No related tags found
No related merge requests found
......@@ -3,12 +3,12 @@ Meteor.methods
if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] setUsername -> Invalid user")
unless RocketChat.settings.get("Accounts_AllowUsernameChange")
throw new Meteor.Error(403, "[methods] resetAvatar -> Invalid access")
user = Meteor.user()
console.log '[methods] setUsername -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
if user.username? and not RocketChat.settings.get("Accounts_AllowUsernameChange")
throw new Meteor.Error(403, "[methods] setUsername -> Username change not allowed")
user = Meteor.user()
console.log '[methods] setUsername -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
if user.username is username
return username
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment