Enable login by role both on frontend and backend
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'qs';
|
||||
import {updateMessages} from '../actions/notification/notificationActions';
|
||||
import {authActivity} from '../constants/authConstants';
|
||||
import {authActivity, LOGOUT} from '../constants/authConstants';
|
||||
import {notificationMessages} from '../constants/notificationConstants';
|
||||
import {store} from '../configureStore';
|
||||
|
||||
@@ -76,6 +76,35 @@ class HtmlClient {
|
||||
});
|
||||
store.dispatch(updateMessages(messages));
|
||||
return;
|
||||
case 'rest_forbidden': case 'woocommerce_rest_cannot_view':
|
||||
store.dispatch( {
|
||||
type: LOGOUT,
|
||||
isLoggedIn: false,
|
||||
errorMessage: 'LOGGED_OUT'
|
||||
});
|
||||
store.dispatch(updateMessages([{ code: 'error', message: `No permission!` }]));
|
||||
return;
|
||||
case '[jwt_auth] empty_username':
|
||||
store.dispatch(updateMessages([{ code: 'error', message: `Empty username!` }]));
|
||||
return;
|
||||
case '[jwt_auth] invalid_username':
|
||||
store.dispatch(updateMessages([{ code: 'error', message: `Invalid username!` }]));
|
||||
return;
|
||||
case '[jwt_auth] empty_password':
|
||||
store.dispatch(updateMessages([{ code: 'error', message: `Empty password!` }]));
|
||||
return;
|
||||
case '[jwt_auth] incorrect_password':
|
||||
store.dispatch(updateMessages([{ code: 'error', message: `Invalid password!` }]));
|
||||
return;
|
||||
case '[jwt_auth] wiaas_authentication_error':
|
||||
store.dispatch( {
|
||||
type: LOGOUT,
|
||||
isLoggedIn: false,
|
||||
errorMessage: 'LOGGED_OUT'
|
||||
});
|
||||
store.dispatch(updateMessages([{ code: 'error', message: `No Customer permission!` }]));
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
store.dispatch(updateMessages([{code:'error', message: 'HTML_ERROR'}], notificationMessages));
|
||||
|
||||
Reference in New Issue
Block a user