I have built a basic Telescope Application. When I enter a wrong password it displays the error message 'Login Forbidden'. I want to change the error message something relevant to the action. Where and what code should I include to make the changes?
Override 'Login Forbidden' error message in meteor-useraccounts
1.1k Views Asked by sohan At
2
There are 2 best solutions below
0

I'm assuming you are using Meteor's Accounts package, since you haven't indicated otherwise.
You can override the Accounts.validateLoginAttempt
function (docs), to throw a Meteor.Error
. As written in the docs:
A validate login callback must return a truthy value for the login to proceed. > If the callback returns a falsy value or throws an exception, the login is > aborted. Throwing a
Meteor.Error
will report the error reason to the user.
Instead of replacing the
Accounts.validateLoginAttempt
function, I recommend to configure a mapping via themeteor-accounts-t9n
API (assuming you just want to replace the error message):meteor add softwarerero:accounts-t9n