return error status on login
This commit is contained in:
@@ -73,7 +73,9 @@ class Wiaas_Authentication {
|
|||||||
// not available roles for user
|
// not available roles for user
|
||||||
$current_user->set_role('');
|
$current_user->set_role('');
|
||||||
|
|
||||||
return new WP_Error('wiaas_authentication_error', 'No set permissions!');
|
return new WP_Error('wiaas_authentication_error', 'No set permissions!', array(
|
||||||
|
'status' => 403,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// authenticate valid admin panel user
|
// authenticate valid admin panel user
|
||||||
@@ -115,7 +117,9 @@ class Wiaas_Authentication {
|
|||||||
$user->set_role($role);
|
$user->set_role($role);
|
||||||
|
|
||||||
return empty($role) ?
|
return empty($role) ?
|
||||||
new WP_Error('wiaas_authentication_error', 'No Customer permissions!') :
|
new WP_Error('wiaas_authentication_error', 'No Customer permissions!', array(
|
||||||
|
'status' => 403,
|
||||||
|
)) :
|
||||||
$user;
|
$user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +144,9 @@ class Wiaas_Authentication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($role)) {
|
if (empty($role)) {
|
||||||
return new WP_Error('wiaas_authentication_error', 'No permissions!');
|
return new WP_Error('wiaas_authentication_error', 'No permissions!', array(
|
||||||
|
'status' => 403,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
update_user_meta($user->ID, '_wiaas_admin_role', $role);
|
update_user_meta($user->ID, '_wiaas_admin_role', $role);
|
||||||
@@ -164,7 +170,9 @@ class Wiaas_Authentication {
|
|||||||
$user->set_role($role);
|
$user->set_role($role);
|
||||||
|
|
||||||
return empty($role) ?
|
return empty($role) ?
|
||||||
new WP_Error('wiaas_authentication_error', 'No Customer permissions!') :
|
new WP_Error('wiaas_authentication_error', 'No Customer permissions!', array(
|
||||||
|
'status' => 403,
|
||||||
|
)) :
|
||||||
$data;
|
$data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class HtmlClient {
|
|||||||
case '[jwt_auth] incorrect_password':
|
case '[jwt_auth] incorrect_password':
|
||||||
store.dispatch(updateMessages([{ code: 'error', message: `Invalid password!` }]));
|
store.dispatch(updateMessages([{ code: 'error', message: `Invalid password!` }]));
|
||||||
return;
|
return;
|
||||||
case '[jwt_auth] wiaas_authentication_error':
|
case '[jwt_auth] wiaas_authentication_error': case 'wiaas_authentication_error':
|
||||||
store.dispatch( {
|
store.dispatch( {
|
||||||
type: LOGOUT,
|
type: LOGOUT,
|
||||||
isLoggedIn: false,
|
isLoggedIn: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user