authelia: show existing users before asking who to scope access to

_authelia_scope_access asked for usernames to grant access to a service
without ever showing who already exists — confirmed live, the prompt
just showed a blank "Usernames:" line with nothing to reference. A typo
against an existing name doesn't fail or warn, it silently creates a new,
separate account instead of matching the intended one.

Now lists existing Authelia users (reusing _authelia_list_usernames,
already used elsewhere in this file) right before the prompt, and warns
about the typo/duplicate-account risk explicitly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YEQNc4NfBST1m9NtCZVYa8
This commit is contained in:
Claude
2026-08-20 18:43:13 +00:00
parent 2b6c06e060
commit 15cef3ab1d
+10 -1
View File
@@ -1036,9 +1036,18 @@ _authelia_scope_access() {
prompt_text " Choice [1/2]:" "1" scope_choice
[ "$scope_choice" = "2" ] || return 0
local -a existing_users
mapfile -t existing_users < <(_authelia_list_usernames "$users_file")
if [ "${#existing_users[@]}" -gt 0 ]; then
echo " Existing Authelia users: ${existing_users[*]}"
else
echo " No existing Authelia users yet — anyone you list below gets created fresh."
fi
echo " Usernames who should have access (space-separated). Anyone listed"
echo " who doesn't already have an Authelia account gets one created —"
echo " you'll get their temporary password to hand over."
echo " you'll get their temporary password to hand over. Typos against an"
echo " existing name above create a new, separate account instead of"
echo " matching it, so copy from that list rather than retyping from memory."
local raw_users=""
prompt_text " Usernames:" "" raw_users
local -a usernames