1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-12 10:45:14 +02:00

[Web] Minor fix

This commit is contained in:
andryyy 2021-10-28 22:05:28 +02:00
parent e13bc242a4
commit 514340b2a7
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 3 additions and 9 deletions

View File

@ -812,12 +812,6 @@ function check_login($user, $pass, $app_passwd_data = false) {
global $redis;
global $imap_server;
if ($app_passwd_data === false) {
$app_passwd_data['eas'] = false;
$app_passwd_data['dav'] = false;
$app_passwd_data['proxyauth'] = false;
}
if (!filter_var($user, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) {
$_SESSION['return'][] = array(
'type' => 'danger',
@ -943,8 +937,8 @@ function check_login($user, $pass, $app_passwd_data = false) {
'log' => array(__FUNCTION__, $user, '*'),
'msg' => array('logged_in_as', $user)
);
if ($app_passwd_data['proxyauth'] === true) {
$service = ($app_passwd_data['eas'] === true) ? 'EAS' : (($app_passwd_data['dav'] === true) ? 'DAV' : 'SSO');
if ($app_passwd_data['eas'] === true || $app_passwd_data['dav'] === true) {
$service = ($app_passwd_data['eas'] === true) ? 'EAS' : 'DAV';
$stmt = $pdo->prepare("REPLACE INTO sasl_log (`service`, `app_password`, `username`, `real_rip`) VALUES (:service, :app_id, :username, :remote_addr)");
$stmt->execute(array(
':service' => $service,

View File

@ -23,7 +23,7 @@ if (isset($_SERVER['PHP_AUTH_USER'])) {
elseif (preg_match('/^(\/SOGo|)\/Microsoft-Server-ActiveSync.*/', $original_uri) === 1) {
$is_eas = true;
}
$login_check = check_login($username, $password, array('dav' => $is_dav, 'eas' => $is_eas, 'proxyauth' => true));
$login_check = check_login($username, $password, array('dav' => $is_dav, 'eas' => $is_eas));
if ($login_check === 'user') {
header("X-User: $username");
header("X-Auth: Basic ".base64_encode("$username:$password"));