Override login denied error message in meteor-useraccounts

I created a basic application for a telescope. When I enter the wrong password, the error message "Login barring" is displayed. I want to change the error message related to the action. Where and what code should be included to make changes?

0
source share
2 answers

Instead of replacing the Accounts.validateLoginAttempt function, I recommend meteor-accounts-t9n up the mapping through the meteor-accounts-t9n API (assuming you just want to replace the error message):

  • Run meteor add softwarerero:accounts-t9n
  • Add the following code:

 if (Meteor.isClient) { T9n.map('en', { error: { accounts: { 'Login forbidden': 'Credentials are incorrect!' } } }); } 
+2
source

I assume that you are using the Meteor Accounts package, as you did not specify otherwise. You can override the Accounts.validateLoginAttempt ( docs ) function to throw a Meteor.Error . As written in the docs:

Verifying that the login is correct should return a valid value for the login. > If the callback returns a fake value or throws an exception, the login> is canceled. Throwing Meteor.Error will Meteor.Error user of the error.

+2
source

Source: https://habr.com/ru/post/1242395/


All Articles