-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: api login should not suggest which credential is wrong
- Loading branch information
Showing
5 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
apps/meteor/app/lib/server/lib/loginErrorMessageOverride.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
apps/meteor/app/lib/server/lib/loginErrorMessageOverride.ts
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,16 @@ | ||
// Do not disclose if user exists when password is invalid | ||
import { Accounts } from 'meteor/accounts-base'; | ||
import { Meteor } from 'meteor/meteor'; | ||
|
||
const { _runLoginHandlers } = Accounts; | ||
|
||
Accounts._options.ambiguousErrorMessages = true; | ||
Accounts._runLoginHandlers = async function (methodInvocation, options) { | ||
const result = await _runLoginHandlers.call(Accounts, methodInvocation, options); | ||
|
||
if (result.error instanceof Meteor.Error) { | ||
result.error = new Meteor.Error(401, 'User not found'); | ||
} | ||
|
||
return result; | ||
}; |
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
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
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