37 lines
972 B
PHP
Executable File
37 lines
972 B
PHP
Executable File
<?php
|
|
|
|
if (! function_exists('m3_user')) {
|
|
/**
|
|
* Return the current Core username in the format expected by the legacy M3 data.
|
|
* M3 previously depended on PHP Basic Auth and read PHP_AUTH_USER directly.
|
|
*/
|
|
function m3User(): string
|
|
{
|
|
$user = auth()->user();
|
|
|
|
$value = $user?->username
|
|
?? $user?->user_name
|
|
?? $user?->name
|
|
?? $user?->email
|
|
?? request()->server('PHP_AUTH_USER')
|
|
?? '';
|
|
|
|
if (str_contains((string) $value, '@')) {
|
|
$value = strstr((string) $value, '@', true) ?: $value;
|
|
}
|
|
|
|
return strtoupper(trim((string) $value));
|
|
}
|
|
}
|
|
|
|
if (! function_exists('m3_legacy_password')) {
|
|
/**
|
|
* Passwords are intentionally unavailable in Core. PostgreSQL access uses
|
|
* Laravel's configured connection and never reuses a user's login password.
|
|
*/
|
|
function m3LegacyPassword(): string
|
|
{
|
|
return '';
|
|
}
|
|
}
|