diff --git a/app/Config/Auth.php b/app/Config/Auth.php
index d84bd34..f2aa7a3 100644
--- a/app/Config/Auth.php
+++ b/app/Config/Auth.php
@@ -157,7 +157,7 @@ class Auth extends ShieldAuth
* --------------------------------------------------------------------
* Determines whether users can register for the site.
*/
- public bool $allowRegistration = true;
+ public bool $allowRegistration = false;
/**
* --------------------------------------------------------------------
diff --git a/app/Views/auth/login.php b/app/Views/auth/login.php
index 89d85e2..f93309f 100644
--- a/app/Views/auth/login.php
+++ b/app/Views/auth/login.php
@@ -114,12 +114,6 @@
-
-
-
-
diff --git a/scripts/manage_hms_cron.sh b/scripts/manage_hms_cron.sh
new file mode 100644
index 0000000..374d43c
--- /dev/null
+++ b/scripts/manage_hms_cron.sh
@@ -0,0 +1,302 @@
+#!/usr/bin/env bash
+
+# ==============================================================================
+# HMS CI4 - Cron Job Manager Script
+# ==============================================================================
+# Usage:
+# bash scripts/manage_hms_cron.sh install [project_dir]
+# bash scripts/manage_hms_cron.sh add "" "" [log_name] [project_dir]
+# bash scripts/manage_hms_cron.sh list
+# bash scripts/manage_hms_cron.sh remove ""
+# bash scripts/manage_hms_cron.sh uninstall
+# bash scripts/manage_hms_cron.sh test "" [project_dir]
+#
+# Examples:
+# bash scripts/manage_hms_cron.sh install /var/www/html/hms_etria
+# bash scripts/manage_hms_cron.sh add "*/5 * * * *" "spark abdm:push-sync --limit=20" "abdm_push.log"
+# bash scripts/manage_hms_cron.sh list
+# bash scripts/manage_hms_cron.sh remove "abdm:push-sync"
+# ==============================================================================
+
+set -euo pipefail
+
+BLOCK_START="# BEGIN HMS_CI4_AUTOGENERATED_CRON"
+BLOCK_END="# END HMS_CI4_AUTOGENERATED_CRON"
+
+# Resolve PHP CLI binary (prefers php83 / php82 / php8.3 / php8.2 over default php)
+detect_php() {
+ if [ -n "${PHP_BIN:-}" ]; then
+ echo "$PHP_BIN"
+ return
+ fi
+ for cand in php83 php8.3 php82 php8.2 php; do
+ if command -v "$cand" >/dev/null 2>&1; then
+ echo "$(command -v "$cand")"
+ return
+ fi
+ done
+ echo "php"
+}
+
+# Resolve project directory
+resolve_project_dir() {
+ local dir="${1:-}"
+ if [ -z "$dir" ]; then
+ # If script is inside scripts/, project root is parent
+ local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+ if [ -f "${script_dir}/../spark" ]; then
+ dir="$(cd "${script_dir}/.." && pwd)"
+ else
+ dir="/var/www/html/hms_etria"
+ fi
+ fi
+ echo "$dir"
+}
+
+# ------------------------------------------------------------------------------
+# Action: List Cron Jobs
+# ------------------------------------------------------------------------------
+cmd_list() {
+ echo "=== Current HMS Managed Cron Jobs ==="
+ local cron_block
+ cron_block="$(crontab -l 2>/dev/null | awk -v start="$BLOCK_START" -v end="$BLOCK_END" '
+ $0 == start {flag=1; next}
+ $0 == end {flag=0; next}
+ flag {print}
+ ' || true)"
+
+ if [ -z "$cron_block" ]; then
+ echo "No HMS cron jobs found in crontab."
+ else
+ echo "$cron_block"
+ fi
+}
+
+# ------------------------------------------------------------------------------
+# Action: Install Default Cron Suite
+# ------------------------------------------------------------------------------
+cmd_install() {
+ local project_dir
+ project_dir="$(resolve_project_dir "${1:-}")"
+ local php_bin
+ php_bin="$(detect_php)"
+ local log_dir="${project_dir}/writable/logs/cron"
+
+ if [ ! -d "$project_dir" ]; then
+ echo "ERROR: Project directory not found: $project_dir"
+ exit 1
+ fi
+
+ mkdir -p "$log_dir"
+
+ local tmp_cron
+ tmp_cron="$(mktemp)"
+ trap 'rm -f "$tmp_cron"' EXIT
+
+ # Keep non-HMS crontab lines
+ crontab -l 2>/dev/null | awk -v start="$BLOCK_START" -v end="$BLOCK_END" '
+ $0 == start {in_block=1; next}
+ $0 == end {in_block=0; next}
+ !in_block {print}
+ ' > "$tmp_cron"
+
+ # Append default managed block
+ cat >> "$tmp_cron" <> $log_dir/abdm_push_sync.log 2>&1
+# ABDM Bridge Records Sync (Every 1 minute)
+* * * * * cd $project_dir && $php_bin spark bridge:sync --limit 10 >> $log_dir/bridge_sync.log 2>&1
+# SNOMED CT Medical Coding Worker (Every 1 minute)
+* * * * * cd $project_dir && $php_bin spark snomed:process-coding >> $log_dir/snomed_process.log 2>&1
+# ABDM M3 HIU Data Request Poll (Every 2 minutes)
+*/2 * * * * cd $project_dir && $php_bin spark abdm:hiu-poll --limit=30 >> $log_dir/abdm_hiu_poll.log 2>&1
+# ABDM M3 HIU Retry Queue (Every 5 minutes)
+*/5 * * * * cd $project_dir && $php_bin spark abdm:hiu-retry --limit=20 >> $log_dir/abdm_hiu_retry.log 2>&1
+# ABDM Audit & Gateway Log Maintenance (Daily at 02:30 AM)
+30 2 * * * cd $project_dir && $php_bin spark abdm:prune-logs --days=30 --strip-payload-days=2 --optimize >> $log_dir/abdm_prune_logs.log 2>&1
+$BLOCK_END
+EOF
+
+ crontab "$tmp_cron"
+ echo "Successfully installed default HMS cron suite for: $project_dir"
+ echo "PHP binary detected: $php_bin"
+ echo "Logs directory: $log_dir"
+ echo ""
+ cmd_list
+}
+
+# ------------------------------------------------------------------------------
+# Action: Add / Append a single task to cron
+# ------------------------------------------------------------------------------
+cmd_add() {
+ local schedule="${1:-}"
+ local command_str="${2:-}"
+ local log_file="${3:-}"
+ local project_dir
+ project_dir="$(resolve_project_dir "${4:-}")"
+ local php_bin
+ php_bin="$(detect_php)"
+ local log_dir="${project_dir}/writable/logs/cron"
+
+ if [ -z "$schedule" ] || [ -z "$command_str" ]; then
+ echo "Usage: $0 add \"\" \"\" [log_file] [project_dir]"
+ echo "Example: $0 add \"*/5 * * * *\" \"spark abdm:push-sync --limit=20\" \"abdm_push.log\""
+ exit 1
+ fi
+
+ mkdir -p "$log_dir"
+
+ # Normalize command: if starts with 'spark ', wrap with cd and php
+ local full_exec=""
+ if [[ "$command_str" =~ ^spark[[:space:]] ]] || [[ "$command_str" == "spark" ]]; then
+ full_exec="cd $project_dir && $php_bin $command_str"
+ elif [[ "$command_str" =~ ^php[[:space:]]spark ]]; then
+ full_exec="cd $project_dir && $command_str"
+ else
+ full_exec="$command_str"
+ fi
+
+ # Append log redirection if log_file is provided or auto-generate
+ if [ -n "$log_file" ]; then
+ full_exec="${full_exec} >> ${log_dir}/${log_file} 2>&1"
+ fi
+
+ local new_cron_line="${schedule} ${full_exec}"
+
+ local tmp_cron
+ tmp_cron="$(mktemp)"
+ trap 'rm -f "$tmp_cron"' EXIT
+
+ local existing_crontab
+ existing_crontab="$(crontab -l 2>/dev/null || true)"
+
+ if echo "$existing_crontab" | grep -q "$BLOCK_START"; then
+ # Insert before BLOCK_END
+ awk -v start="$BLOCK_START" -v end="$BLOCK_END" -v newline="$new_cron_line" '
+ $0 == end { print newline; print $0; next }
+ { print }
+ ' <<< "$existing_crontab" > "$tmp_cron"
+ else
+ # No HMS block yet: create block
+ cat <<< "$existing_crontab" > "$tmp_cron"
+ cat >> "$tmp_cron" <\""
+ echo "Example: $0 remove \"abdm:push-sync\""
+ exit 1
+ fi
+
+ local tmp_cron
+ tmp_cron="$(mktemp)"
+ trap 'rm -f "$tmp_cron"' EXIT
+
+ local existing_crontab
+ existing_crontab="$(crontab -l 2>/dev/null || true)"
+
+ awk -v start="$BLOCK_START" -v end="$BLOCK_END" -v pat="$pattern" '
+ $0 == start { in_block=1; print; next }
+ $0 == end { in_block=0; print; next }
+ in_block && $0 ~ pat { next }
+ { print }
+ ' <<< "$existing_crontab" > "$tmp_cron"
+
+ crontab "$tmp_cron"
+ echo "Removed any task matching: $pattern"
+ echo ""
+ cmd_list
+}
+
+# ------------------------------------------------------------------------------
+# Action: Uninstall HMS Cron Block completely
+# ------------------------------------------------------------------------------
+cmd_uninstall() {
+ local tmp_cron
+ tmp_cron="$(mktemp)"
+ trap 'rm -f "$tmp_cron"' EXIT
+
+ crontab -l 2>/dev/null | awk -v start="$BLOCK_START" -v end="$BLOCK_END" '
+ $0 == start {in_block=1; next}
+ $0 == end {in_block=0; next}
+ !in_block {print}
+ ' > "$tmp_cron"
+
+ crontab "$tmp_cron"
+ echo "Uninstalled all HMS managed cron jobs."
+}
+
+# ------------------------------------------------------------------------------
+# Action: Test run a command immediately
+# ------------------------------------------------------------------------------
+cmd_test() {
+ local command_str="${1:-}"
+ local project_dir
+ project_dir="$(resolve_project_dir "${2:-}")"
+ local php_bin
+ php_bin="$(detect_php)"
+
+ if [ -z "$command_str" ]; then
+ echo "Usage: $0 test \"\" [project_dir]"
+ echo "Example: $0 test \"spark abdm:push-sync --limit=5\""
+ exit 1
+ fi
+
+ echo "Running test: cd $project_dir && $php_bin $command_str"
+ cd "$project_dir" && "$php_bin" $command_str
+}
+
+# ------------------------------------------------------------------------------
+# CLI Router
+# ------------------------------------------------------------------------------
+case "${1:-help}" in
+ install)
+ shift
+ cmd_install "$@"
+ ;;
+ add)
+ shift
+ cmd_add "$@"
+ ;;
+ list)
+ cmd_list
+ ;;
+ remove)
+ shift
+ cmd_remove "$@"
+ ;;
+ uninstall)
+ cmd_uninstall
+ ;;
+ test)
+ shift
+ cmd_test "$@"
+ ;;
+ *)
+ echo "HMS CI4 Cron Job Manager"
+ echo "Usage:"
+ echo " bash scripts/manage_hms_cron.sh install [project_dir]"
+ echo " bash scripts/manage_hms_cron.sh add \"\" \"\" [log_file] [project_dir]"
+ echo " bash scripts/manage_hms_cron.sh list"
+ echo " bash scripts/manage_hms_cron.sh remove \"\""
+ echo " bash scripts/manage_hms_cron.sh uninstall"
+ echo " bash scripts/manage_hms_cron.sh test \"\" [project_dir]"
+ ;;
+esac