feat: Improve migration UX on login page

- Show 'Database Migration Required' heading instead of welcome message when migrations pending
- Add warning alert explaining credentials needed to authorize migration
- Change button text from 'Go' to 'Migrate' during migration flow
- Add language strings for clear migration messaging

This makes it clear to the user that they are performing a migration
authorization step (not a regular login), and will need to re-authenticate
after migrations complete.
This commit is contained in:
Ollama
2026-04-02 06:27:14 +00:00
parent 67c93d4741
commit 1be8602e3c
3 changed files with 16 additions and 8 deletions

View File

@@ -70,7 +70,8 @@ class Load_config
// If database is not migrated and we're configured to use database sessions,
// temporarily fall back to file-based sessions to allow migrations to complete.
// Once migrations run, subsequent requests will use database sessions.
// Once migrations run, the user must re-authenticate (session is destroyed in
// load_config() when migrations are pending).
if (!$isDbMigrated && $sessionConfig->driver === DatabaseHandler::class) {
$sessionConfig = clone $sessionConfig;
$sessionConfig->driver = FileHandler::class;

View File

@@ -9,6 +9,9 @@ return [
"login" => "Login",
"logout" => "Logout",
"migration_needed" => "A database migration to {0} will start after login.",
"migration_required" => "Database Migration Required",
"migration_auth_message" => "Administrator credentials are required to authorize the database migration to version {0}. Please login to proceed.",
"migration_complete_redirect" => "Migration complete. Redirecting to login...",
"password" => "Password",
"required_username" => "The username field is required.",
"username" => "Username",

View File

@@ -47,7 +47,14 @@
</div>
<section class="box-login d-flex flex-column justify-content-center align-items-center p-md-4">
<?= form_open('login') ?>
<h3 class="text-center m-0"><?= lang('Login.welcome', [lang('Common.software_short')]) ?></h3>
<?php if (!$is_latest): ?>
<h3 class="text-center m-0"><?= lang('Login.migration_required') ?></h3>
<div class="alert alert-warning mt-3">
<strong><?= lang('Login.migration_auth_message', [$latest_version]) ?></strong>
</div>
<?php else: ?>
<h3 class="text-center m-0"><?= lang('Login.welcome', [lang('Common.software_short')]) ?></h3>
<?php endif; ?>
<?php if ($has_errors): ?>
<?php foreach ($validation->getErrors() as $error): ?>
<div class="alert alert-danger mt-3">
@@ -55,11 +62,6 @@
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!$is_latest): ?>
<div class="alert alert-info mt-3">
<?= lang('Login.migration_needed', [$latest_version]) ?>
</div>
<?php endif; ?>
<?php if (empty($config['login_form']) || 'floating_labels' == ($config['login_form'])): ?>
<div class="form-floating mt-3">
<input class="form-control" id="input-username" name="username" type="text" placeholder="<?= lang('Login.username') ?>" <?php if (ENVIRONMENT == "testing") echo 'value="admin"'; ?>>
@@ -96,7 +98,9 @@
}
?>
<div class="d-grid">
<button class="btn btn-lg btn-primary" name="login-button" type="submit"><?= lang('Login.go') ?></button>
<button class="btn btn-lg btn-primary" name="login-button" type="submit">
<?= $is_latest ? lang('Login.go') : lang('Module.migrate') ?>
</button>
</div>
<?= form_close() ?>
</section>