-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7616 from RocketChat/improvements/login-error-mes…
…sages Improve login error messages
- Loading branch information
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/rocketchat-lib/server/lib/loginErrorMessageOverride.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Do not disclose if user exists when password is invalid | ||
const _runLoginHandlers = Accounts._runLoginHandlers; | ||
Accounts._runLoginHandlers = function(methodInvocation, options) { | ||
const result = _runLoginHandlers.call(Accounts, methodInvocation, options); | ||
|
||
if (result.error && result.error.reason === 'Incorrect password') { | ||
result.error = new Meteor.Error(403, 'User not found'); | ||
} | ||
|
||
return result; | ||
}; |