witoldsz / angular-http-auth

MIT License
2.37k stars 416 forks source link

Suggestion: add loginFailed #75

Open Rykus0 opened 10 years ago

Rykus0 commented 10 years ago

I think It would be helpful to have a loginFailed routine that did not clear the buffer, and broadcast a message indicating a failed login attempt.

Mostly because the other related messages are controlled from the authService, so it makes sense to group them together. It would probably be invoked by an external module.

For example: I open a modal login box on event:auth-loginConfirmed. If I receive this event again while the modal is still open, I know the login failed (just using basic auth and getting a 401 when attempting with the credentials). I could call loginFailed to broadcast an event that could be used to display an error and maybe increment a failed attempt counter...

I'm short on time this week, but I can probably add this in next week and send a pull request.