[Web] fix malformed_username check
This commit is contained in:
@@ -47,12 +47,14 @@ function check_login($user, $pass, $app_passwd_data = false, $extra = null) {
|
|||||||
function admin_login($user, $pass){
|
function admin_login($user, $pass){
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
if (!ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
|
if (!filter_var($user, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
|
||||||
$_SESSION['return'][] = array(
|
if (!$is_internal){
|
||||||
'type' => 'danger',
|
$_SESSION['return'][] = array(
|
||||||
'log' => array(__FUNCTION__, $user, '*'),
|
'type' => 'danger',
|
||||||
'msg' => 'malformed_username'
|
'log' => array(__FUNCTION__, $user, '*'),
|
||||||
);
|
'msg' => 'malformed_username'
|
||||||
|
);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,12 +101,14 @@ function admin_login($user, $pass){
|
|||||||
function domainadmin_login($user, $pass){
|
function domainadmin_login($user, $pass){
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
if (!ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
|
if (!filter_var($user, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
|
||||||
$_SESSION['return'][] = array(
|
if (!$is_internal){
|
||||||
'type' => 'danger',
|
$_SESSION['return'][] = array(
|
||||||
'log' => array(__FUNCTION__, $user, '*'),
|
'type' => 'danger',
|
||||||
'msg' => 'malformed_username'
|
'log' => array(__FUNCTION__, $user, '*'),
|
||||||
);
|
'msg' => 'malformed_username'
|
||||||
|
);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +319,7 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $extra = null){
|
|||||||
|
|
||||||
$is_internal = $extra['is_internal'];
|
$is_internal = $extra['is_internal'];
|
||||||
$create = $extra['create'];
|
$create = $extra['create'];
|
||||||
|
|
||||||
if (!filter_var($user, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
|
if (!filter_var($user, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
|
||||||
if (!$is_internal){
|
if (!$is_internal){
|
||||||
$_SESSION['return'][] = array(
|
$_SESSION['return'][] = array(
|
||||||
|
Reference in New Issue
Block a user