Fix identity provider gaps: a required provider is decided before any password or mail password is checked and the sign-in page says the same whatever was typed, account or not; required beats IMAP on the same domain; after five wrong passwords for an address in ten minutes its mail server isn't asked; Google signs in only Workspace accounts and Nextcloud has to say the address is verified; client secrets are sealed with the install key, with RMM's sealing moved to shared secretSeal and secretOpen; an IMAP server is tried when saved or turned on and Required waits for a first sign-in; joining, Forgot password, password links and welcome emails follow mail-password and required domains; Turn Off says who goes back to a password; 26.12.3 changelog entries

This commit is contained in:
johnnyq
2026-11-30 01:36:20 -05:00
parent 8ce7ad0789
commit adbd8866c2
18 changed files with 499 additions and 142 deletions

View File

@@ -13,8 +13,8 @@
*
* The Microsoft Entra app the client portal signed in with (settings.config_azure_client_id and
* config_azure_client_secret) becomes the first provider, for client contacts on any domain, still
* sending them back to /client/login_microsoft.php - the address registered with it - and the two
* settings go. Contacts set to sign in with Microsoft keep that (users.user_auth_method azure),
* sending them back to /client/login_microsoft.php - the address registered with it - with its
* secret sealed (secretSeal()), and the two settings go. Contacts set to sign in with Microsoft keep that (users.user_auth_method azure),
* now meaning through an identity provider, without a password. Re-runnable.
*/
@@ -52,6 +52,10 @@ defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
$itflow_azure_secret = trim((string) ($itflow_azure['config_azure_client_secret'] ?? ''));
$itflow_providers = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM identity_providers"))[0] ?? 0);
if ($itflow_azure_id !== '' && $itflow_providers === 0) {
// Its secret sealed with this install's key, as one typed in Admin > Identity Providers is (secretSeal()) - kept as it
// was when the install can't make a key, or this run started on code from before it, and read as it is
$itflow_azure_sealed = function_exists('secretSeal') && $itflow_azure_secret !== '' ? secretSeal($itflow_azure_secret, 'identity-provider') : '';
$itflow_azure_secret = $itflow_azure_sealed !== '' ? $itflow_azure_sealed : $itflow_azure_secret;
mysqli_query($mysqli, "INSERT INTO identity_providers SET identity_provider_kind = 'microsoft', identity_provider_name = 'Microsoft 365',
identity_provider_enabled = 1, identity_provider_agents = 0, identity_provider_contacts = 1,
identity_provider_client_id = '" . mysqli_real_escape_string($mysqli, $itflow_azure_id) . "',