feat: add LDAP authentication settings and toggle

Add an admin-only LDAP configuration UI with an enable toggle and full
sign-in integration.

Backend:
- ldapSettings model + migration (single-row config)
- GET/PUT/test routes under /ldap (admin-gated; bind password masked)
- shared ldapClient with RFC 4515 filter escaping and empty-password guard
- signin tries local auth first, then LDAP when enabled (find-or-create
  local user) so the bootstrap admin is never locked out

Frontend:
- LDAP settings page (Switch + form + test connection) under /admin/ldap
- AdminNav tabs between user management and LDAP
- ldapControl util, types, and Ldap i18n namespace for all 6 locales

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
LittleYellow
2026-06-26 07:20:08 +08:00
parent 02fa631f02
commit 1c977f9266
25 changed files with 992 additions and 19 deletions

View File

@@ -149,6 +149,7 @@
},
"Admin": {
"user_management": "ユーザー管理",
"ldap": "LDAP",
"avatar": "アバター",
"id": "ID",
"email": "メールアドレス",
@@ -434,5 +435,27 @@
"tag_error_create": "タグの作成に失敗しました。もう一度お試しください。",
"tag_error_update": "タグの更新に失敗しました。もう一度お試しください。",
"tag_error_delete": "タグの削除に失敗しました。もう一度お試しください。"
},
"Ldap": {
"ldap_settings": "LDAP 設定",
"ldap_description": "LDAP ディレクトリでユーザーを認証します。",
"enable_ldap": "LDAP を有効化",
"enable_ldap_desc": "ユーザーがディレクトリの資格情報でサインインできるようにします。",
"server_url": "サーバー URL",
"bind_dn": "バインド DN",
"bind_credentials": "バインドパスワード",
"bind_credentials_placeholder": "現在のパスワードを保持する場合は空欄",
"search_base": "検索ベース",
"search_filter": "検索フィルター",
"email_attribute": "メール属性",
"username_attribute": "ユーザー名属性",
"save": "保存",
"saved": "LDAP 設定を保存しました",
"save_error": "LDAP 設定の保存に失敗しました",
"test_connection": "接続テスト",
"test_username": "テストユーザー名",
"test_password": "テストパスワード",
"test_success": "接続に成功しました",
"test_failed": "接続に失敗しました"
}
}