Skip to content

Commit

Permalink
Emit authorization_error when username/password fails (invalid_user_p…
Browse files Browse the repository at this point in the history
…assword)
  • Loading branch information
luisrudge committed Jun 9, 2017
1 parent fda9869 commit 6bb0f42
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,19 @@ export function logInSuccess(id, result) {
}

function logInError(id, fields, error, localHandler) {
const errorCode = error.error || error.code;
localHandler(id, error, fields, () =>
setTimeout(() => {
const m = read(getEntity, 'lock', id);
const errorMessage = l.loginErrorMessage(m, error, loginType(fields));

if (['blocked_user', 'rule_error', 'lock.unauthorized'].indexOf(error.code) > -1) {
const errorCodesThatEmitAuthorizationErrorEvent = [
'blocked_user',
'rule_error',
'lock.unauthorized',
'invalid_user_password'
];

if (errorCodesThatEmitAuthorizationErrorEvent.indexOf(errorCode) > -1) {
l.emitAuthorizationErrorEvent(m, error);
}

Expand Down

0 comments on commit 6bb0f42

Please sign in to comment.