Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override Login forbidden #216

Closed
Hareramrai opened this issue Dec 24, 2014 · 9 comments
Closed

override Login forbidden #216

Hareramrai opened this issue Dec 24, 2014 · 9 comments

Comments

@Hareramrai
Copy link

Hi,

Can anyone help me to override the default authentication error message "Login forbidden" to "Incorrect Login" .

Thanks,
hare

@splendido
Copy link
Member

Lets have a look at this block.
Set overrideLoginErrors to false and put ot within your server side code.

But this is something to add to the configuration options!
Tnx for asking

@Hareramrai
Copy link
Author

If I will set overrideLoginErrors to false then it will either show "user not found " or "Incorrect password".

Is there any way to change these message "user not found" and "Incorrect password" ?

thanks for your help.

@splendido
Copy link
Member

It is exactly the block I've linked above which does the trick!

Try something like within your server code:

        var myMsg = "Incorrect Login";
        Accounts.validateLoginAttempt(function(attempt){
            if (attempt.error){
                var reason = attempt.error.reason;
                if (reason === "User not found" || reason === "Incorrect password")
                    throw new Meteor.Error(403, myMsg);
            }
            return attempt.allowed;
        });

@Hareramrai
Copy link
Author

thank you. Its working ..

@splendido
Copy link
Member

I'm going to add this as a configuration option!

@splendido splendido reopened this Dec 26, 2014
@splendido
Copy link
Member

Actually, after having looked again to the code, it turns out you could also change the mapping on accounts-t9n with:

T9n.map('en', {
  error: {
    accounts: {
      'Login forbidden': 'Not for you'
    }
  }
});

...and you should do this for all languages you're interested int.

Alternatively you could also change single login errors while keeping overrideLoginErrors' to false: see the docs

@MarcioAntonioRezende
Copy link

I experimented this same error using semantic:accounts-ui. I just remove the pack and greats news... it work...

@v3rron
Copy link

v3rron commented Jul 11, 2015

Still have the same issue with semantic-ui package

@splendido
Copy link
Member

which error/issue?
This was about changing the appearing text... wasn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants