M3 Integration fixes
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
<?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 m3_user(): 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 m3_legacy_password(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user