mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-13 05:47:23 -04:00
* fix(login): skip auth validation on new install to allow migration On fresh installs with no DB version, login validation would fail before migrations could run. Check MY_Migration::getCurrentVersion() and bypass credential check when no version exists. Signed-off-by: Travis Garrison <travis@chiraqbookstore.com> * fix(login): distinguish DB unavailable from empty install `getCurrentVersion()` previously returned `int` with 0 used for both \"empty database\" and \"DB connection failure\". This conflated two distinct states, causing login to skip auth when DB was unreachable. Changes: - Return type widened to `?int`: null = DB unavailable, 0 = confirmed empty DB (new install), positive int = migrated - Login controller now returns 503 on null (DB error) before checking isNewInstall - isNewInstall gate now uses `=== 0` instead of falsy check Signed-off-by: Travis Garrison <travis@chiraqbookstore.com> * fix(login): return 503 JSON response when DB connection unavailable Extract getCurrentVersion() before building data array to distinguish null (connection failure) from 0 (new install). Return early with JSON 503 when DB is unreachable instead of rendering broken view. Update return type hint to include ResponseInterface. Signed-off-by: Travis Garrison <travis@chiraqbookstore.com> --------- Signed-off-by: Travis Garrison <travis@chiraqbookstore.com> Co-authored-by: Travis Garrison <travis@chiraqbookstore.com> Co-authored-by: jekkos <jekkos@users.noreply.github.com>