The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/methods/setUserPassword.coffee

16 lines
563 B

Meteor.methods
setUserPassword: (password) ->
check password, String
if not Meteor.userId()
throw new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'setUserPassword' }
user = RocketChat.models.Users.findOneById Meteor.userId()
if user and user.requirePasswordChange isnt true
throw new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'setUserPassword' }
Accounts.setPassword(Meteor.userId(), password, { logout: false });
return RocketChat.models.Users.unsetRequirePasswordChange(Meteor.userId());
return true;