mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 02:35:18 -05:00
feat: add passkey authentication and enhance user preferences - Add passkey login security event type with fingerprint icon - Include request and site context in email confirmation for backend - Add user_id exact match filter to prevent incorrect user lookups - Enable PATCH method for updating user preferences via API - Add moderation_preferences support to user settings - Optimize ticket queries with select_related and prefetch_related This commit introduces passkey authentication tracking, improves user profile filtering accuracy, and extends the preferences API to support updates. Query optimizations reduce database hits for ticket listings.
861 lines
30 KiB
Python
861 lines
30 KiB
Python
"""
|
|
Rich Choice Objects for Accounts Domain
|
|
|
|
This module defines all choice objects used in the accounts domain,
|
|
replacing tuple-based choices with rich, metadata-enhanced choice objects.
|
|
|
|
Last updated: 2025-01-15
|
|
"""
|
|
|
|
from apps.core.choices import ChoiceGroup, RichChoice, register_choices
|
|
|
|
# =============================================================================
|
|
# USER ROLES
|
|
# =============================================================================
|
|
|
|
user_roles = ChoiceGroup(
|
|
name="user_roles",
|
|
choices=[
|
|
RichChoice(
|
|
value="USER",
|
|
label="User",
|
|
description="Standard user with basic permissions to create content, reviews, and lists",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "user",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"permissions": ["create_content", "create_reviews", "create_lists"],
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="MODERATOR",
|
|
label="Moderator",
|
|
description="Trusted user with permissions to moderate content and assist other users",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "shield-check",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"permissions": ["moderate_content", "review_submissions", "manage_reports"],
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="ADMIN",
|
|
label="Admin",
|
|
description="Administrator with elevated permissions to manage users and site configuration",
|
|
metadata={
|
|
"color": "purple",
|
|
"icon": "cog",
|
|
"css_class": "text-purple-600 bg-purple-50",
|
|
"permissions": ["manage_users", "site_configuration", "advanced_moderation"],
|
|
"sort_order": 3,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="SUPERUSER",
|
|
label="Superuser",
|
|
description="Full system administrator with unrestricted access to all features",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "key",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"permissions": ["full_access", "system_administration", "database_access"],
|
|
"sort_order": 4,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# THEME PREFERENCES
|
|
# =============================================================================
|
|
|
|
theme_preferences = ChoiceGroup(
|
|
name="theme_preferences",
|
|
choices=[
|
|
RichChoice(
|
|
value="light",
|
|
label="Light",
|
|
description="Light theme with bright backgrounds and dark text for daytime use",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "sun",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"preview_colors": {"background": "#ffffff", "text": "#1f2937", "accent": "#3b82f6"},
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="dark",
|
|
label="Dark",
|
|
description="Dark theme with dark backgrounds and light text for nighttime use",
|
|
metadata={
|
|
"color": "gray",
|
|
"icon": "moon",
|
|
"css_class": "text-gray-600 bg-gray-50",
|
|
"preview_colors": {"background": "#1f2937", "text": "#f9fafb", "accent": "#60a5fa"},
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# UNIT SYSTEMS
|
|
# =============================================================================
|
|
|
|
unit_systems = ChoiceGroup(
|
|
name="unit_systems",
|
|
choices=[
|
|
RichChoice(
|
|
value="metric",
|
|
label="Metric",
|
|
description="Use metric units (meters, km/h)",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "ruler",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"units": {
|
|
"distance": "m",
|
|
"speed": "km/h",
|
|
"weight": "kg",
|
|
"large_distance": "km",
|
|
},
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="imperial",
|
|
label="Imperial",
|
|
description="Use imperial units (feet, mph)",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "ruler",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"units": {
|
|
"distance": "ft",
|
|
"speed": "mph",
|
|
"weight": "lbs",
|
|
"large_distance": "mi",
|
|
},
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# PRIVACY LEVELS
|
|
# =============================================================================
|
|
|
|
privacy_levels = ChoiceGroup(
|
|
name="privacy_levels",
|
|
choices=[
|
|
RichChoice(
|
|
value="public",
|
|
label="Public",
|
|
description="Profile and activity visible to all users and search engines",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "globe",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"visibility_scope": "everyone",
|
|
"search_indexable": True,
|
|
"implications": [
|
|
"Profile visible to all users",
|
|
"Activity appears in public feeds",
|
|
"Searchable by search engines",
|
|
"Can be found by username search",
|
|
],
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="friends",
|
|
label="Friends Only",
|
|
description="Profile and activity visible only to accepted friends",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "users",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"visibility_scope": "friends",
|
|
"search_indexable": False,
|
|
"implications": [
|
|
"Profile visible only to friends",
|
|
"Activity hidden from public feeds",
|
|
"Not searchable by search engines",
|
|
"Requires friend request approval",
|
|
],
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="private",
|
|
label="Private",
|
|
description="Profile and activity completely private, visible only to you",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "lock",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"visibility_scope": "self",
|
|
"search_indexable": False,
|
|
"implications": [
|
|
"Profile completely hidden",
|
|
"No activity in any feeds",
|
|
"Not discoverable by other users",
|
|
"Maximum privacy protection",
|
|
],
|
|
"sort_order": 3,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# TOP LIST CATEGORIES
|
|
# =============================================================================
|
|
|
|
top_list_categories = ChoiceGroup(
|
|
name="top_list_categories",
|
|
choices=[
|
|
RichChoice(
|
|
value="RC",
|
|
label="Roller Coaster",
|
|
description="Top lists for roller coasters and thrill rides",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "roller-coaster",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"ride_category": "roller_coaster",
|
|
"typical_list_size": 10,
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="DR",
|
|
label="Dark Ride",
|
|
description="Top lists for dark rides and indoor attractions",
|
|
metadata={
|
|
"color": "purple",
|
|
"icon": "moon",
|
|
"css_class": "text-purple-600 bg-purple-50",
|
|
"ride_category": "dark_ride",
|
|
"typical_list_size": 10,
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="FR",
|
|
label="Flat Ride",
|
|
description="Top lists for flat rides and spinning attractions",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "refresh",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"ride_category": "flat_ride",
|
|
"typical_list_size": 10,
|
|
"sort_order": 3,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="WR",
|
|
label="Water Ride",
|
|
description="Top lists for water rides and splash attractions",
|
|
metadata={
|
|
"color": "cyan",
|
|
"icon": "droplet",
|
|
"css_class": "text-cyan-600 bg-cyan-50",
|
|
"ride_category": "water_ride",
|
|
"typical_list_size": 10,
|
|
"sort_order": 4,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="PK",
|
|
label="Park",
|
|
description="Top lists for theme parks and amusement parks",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "map",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"entity_type": "park",
|
|
"typical_list_size": 10,
|
|
"sort_order": 5,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# NOTIFICATION TYPES
|
|
# =============================================================================
|
|
|
|
notification_types = ChoiceGroup(
|
|
name="notification_types",
|
|
choices=[
|
|
# Submission related
|
|
RichChoice(
|
|
value="submission_approved",
|
|
label="Submission Approved",
|
|
description="Notification when user's submission is approved by moderators",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "check-circle",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"category": "submission",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="submission_rejected",
|
|
label="Submission Rejected",
|
|
description="Notification when user's submission is rejected by moderators",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "x-circle",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"category": "submission",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="submission_pending",
|
|
label="Submission Pending Review",
|
|
description="Notification when user's submission is pending moderator review",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "clock",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"category": "submission",
|
|
"default_channels": ["inapp"],
|
|
"priority": "low",
|
|
"sort_order": 3,
|
|
},
|
|
),
|
|
# Review related
|
|
RichChoice(
|
|
value="review_reply",
|
|
label="Review Reply",
|
|
description="Notification when someone replies to user's review",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "chat-bubble",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"category": "review",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 4,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="review_helpful",
|
|
label="Review Marked Helpful",
|
|
description="Notification when user's review is marked as helpful",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "thumbs-up",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"category": "review",
|
|
"default_channels": ["push", "inapp"],
|
|
"priority": "low",
|
|
"sort_order": 5,
|
|
},
|
|
),
|
|
# Social related
|
|
RichChoice(
|
|
value="friend_request",
|
|
label="Friend Request",
|
|
description="Notification when user receives a friend request",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "user-plus",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"category": "social",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 6,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="friend_accepted",
|
|
label="Friend Request Accepted",
|
|
description="Notification when user's friend request is accepted",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "user-check",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"category": "social",
|
|
"default_channels": ["push", "inapp"],
|
|
"priority": "low",
|
|
"sort_order": 7,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="message_received",
|
|
label="Message Received",
|
|
description="Notification when user receives a private message",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "mail",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"category": "social",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 8,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="profile_comment",
|
|
label="Profile Comment",
|
|
description="Notification when someone comments on user's profile",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "chat",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"category": "social",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 9,
|
|
},
|
|
),
|
|
# System related
|
|
RichChoice(
|
|
value="system_announcement",
|
|
label="System Announcement",
|
|
description="Important announcements from the ThrillWiki team",
|
|
metadata={
|
|
"color": "purple",
|
|
"icon": "megaphone",
|
|
"css_class": "text-purple-600 bg-purple-50",
|
|
"category": "system",
|
|
"default_channels": ["email", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 10,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="account_security",
|
|
label="Account Security",
|
|
description="Security-related notifications for user's account",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "shield-exclamation",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"category": "system",
|
|
"default_channels": ["email", "push", "inapp"],
|
|
"priority": "high",
|
|
"sort_order": 11,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="feature_update",
|
|
label="Feature Update",
|
|
description="Notifications about new features and improvements",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "sparkles",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"category": "system",
|
|
"default_channels": ["email", "inapp"],
|
|
"priority": "low",
|
|
"sort_order": 12,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="maintenance",
|
|
label="Maintenance Notice",
|
|
description="Scheduled maintenance and downtime notifications",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "wrench",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"category": "system",
|
|
"default_channels": ["email", "inapp"],
|
|
"priority": "normal",
|
|
"sort_order": 13,
|
|
},
|
|
),
|
|
# Achievement related
|
|
RichChoice(
|
|
value="achievement_unlocked",
|
|
label="Achievement Unlocked",
|
|
description="Notification when user unlocks a new achievement",
|
|
metadata={
|
|
"color": "gold",
|
|
"icon": "trophy",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"category": "achievement",
|
|
"default_channels": ["push", "inapp"],
|
|
"priority": "low",
|
|
"sort_order": 14,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="milestone_reached",
|
|
label="Milestone Reached",
|
|
description="Notification when user reaches a significant milestone",
|
|
metadata={
|
|
"color": "purple",
|
|
"icon": "flag",
|
|
"css_class": "text-purple-600 bg-purple-50",
|
|
"category": "achievement",
|
|
"default_channels": ["push", "inapp"],
|
|
"priority": "low",
|
|
"sort_order": 15,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# NOTIFICATION PRIORITIES
|
|
# =============================================================================
|
|
|
|
notification_priorities = ChoiceGroup(
|
|
name="notification_priorities",
|
|
choices=[
|
|
RichChoice(
|
|
value="low",
|
|
label="Low",
|
|
description="Low priority notifications that can be delayed or batched",
|
|
metadata={
|
|
"color": "gray",
|
|
"icon": "arrow-down",
|
|
"css_class": "text-gray-600 bg-gray-50",
|
|
"urgency_level": 1,
|
|
"batch_eligible": True,
|
|
"delay_minutes": 60,
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="normal",
|
|
label="Normal",
|
|
description="Standard priority notifications sent in regular intervals",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "minus",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"urgency_level": 2,
|
|
"batch_eligible": True,
|
|
"delay_minutes": 15,
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="high",
|
|
label="High",
|
|
description="High priority notifications sent immediately",
|
|
metadata={
|
|
"color": "orange",
|
|
"icon": "arrow-up",
|
|
"css_class": "text-orange-600 bg-orange-50",
|
|
"urgency_level": 3,
|
|
"batch_eligible": False,
|
|
"delay_minutes": 0,
|
|
"sort_order": 3,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="urgent",
|
|
label="Urgent",
|
|
description="Critical notifications requiring immediate attention",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "exclamation",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"urgency_level": 4,
|
|
"batch_eligible": False,
|
|
"delay_minutes": 0,
|
|
"bypass_preferences": True,
|
|
"sort_order": 4,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# SECURITY EVENT TYPES
|
|
# =============================================================================
|
|
|
|
security_event_types = ChoiceGroup(
|
|
name="security_event_types",
|
|
choices=[
|
|
RichChoice(
|
|
value="login_success",
|
|
label="Login Success",
|
|
description="User successfully logged in to their account",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "login",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "authentication",
|
|
"sort_order": 1,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="login_failed",
|
|
label="Login Failed",
|
|
description="Failed login attempt to user's account",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "login",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"severity": "warning",
|
|
"category": "authentication",
|
|
"sort_order": 2,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="logout",
|
|
label="Logout",
|
|
description="User logged out of their account",
|
|
metadata={
|
|
"color": "gray",
|
|
"icon": "logout",
|
|
"css_class": "text-gray-600 bg-gray-50",
|
|
"severity": "info",
|
|
"category": "authentication",
|
|
"sort_order": 3,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="mfa_enrolled",
|
|
label="MFA Enrolled",
|
|
description="User enabled two-factor authentication",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "shield-check",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "mfa",
|
|
"sort_order": 4,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="mfa_disabled",
|
|
label="MFA Disabled",
|
|
description="User disabled two-factor authentication",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "shield-off",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"severity": "warning",
|
|
"category": "mfa",
|
|
"sort_order": 5,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="mfa_challenge_success",
|
|
label="MFA Challenge Success",
|
|
description="User successfully completed MFA verification",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "shield-check",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "mfa",
|
|
"sort_order": 6,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="mfa_challenge_failed",
|
|
label="MFA Challenge Failed",
|
|
description="User failed MFA verification attempt",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "shield-x",
|
|
"css_class": "text-red-600 bg-red-50",
|
|
"severity": "warning",
|
|
"category": "mfa",
|
|
"sort_order": 7,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="passkey_registered",
|
|
label="Passkey Registered",
|
|
description="User registered a new passkey/WebAuthn credential",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "fingerprint",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "passkey",
|
|
"sort_order": 8,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="passkey_removed",
|
|
label="Passkey Removed",
|
|
description="User removed a passkey/WebAuthn credential",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "fingerprint",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"severity": "warning",
|
|
"category": "passkey",
|
|
"sort_order": 9,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="passkey_login",
|
|
label="Passkey Login",
|
|
description="User logged in using a passkey",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "fingerprint",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "passkey",
|
|
"sort_order": 10,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="social_linked",
|
|
label="Social Account Linked",
|
|
description="User connected a social login provider",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "link",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"severity": "info",
|
|
"category": "social",
|
|
"sort_order": 11,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="social_unlinked",
|
|
label="Social Account Unlinked",
|
|
description="User disconnected a social login provider",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "unlink",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"severity": "info",
|
|
"category": "social",
|
|
"sort_order": 12,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="password_reset_requested",
|
|
label="Password Reset Requested",
|
|
description="Password reset was requested for user's account",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "key",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"severity": "info",
|
|
"category": "password",
|
|
"sort_order": 13,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="password_reset_completed",
|
|
label="Password Reset Completed",
|
|
description="User successfully reset their password",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "key",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "password",
|
|
"sort_order": 14,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="password_changed",
|
|
label="Password Changed",
|
|
description="User changed their password",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "key",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "password",
|
|
"sort_order": 15,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="session_invalidated",
|
|
label="Session Invalidated",
|
|
description="User's session was terminated",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "clock",
|
|
"css_class": "text-yellow-600 bg-yellow-50",
|
|
"severity": "info",
|
|
"category": "session",
|
|
"sort_order": 16,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="recovery_code_used",
|
|
label="Recovery Code Used",
|
|
description="User used a recovery code for authentication",
|
|
metadata={
|
|
"color": "orange",
|
|
"icon": "key",
|
|
"css_class": "text-orange-600 bg-orange-50",
|
|
"severity": "warning",
|
|
"category": "mfa",
|
|
"sort_order": 17,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="recovery_codes_regenerated",
|
|
label="Recovery Codes Regenerated",
|
|
description="User generated new recovery codes",
|
|
metadata={
|
|
"color": "blue",
|
|
"icon": "refresh",
|
|
"css_class": "text-blue-600 bg-blue-50",
|
|
"severity": "info",
|
|
"category": "mfa",
|
|
"sort_order": 18,
|
|
},
|
|
),
|
|
RichChoice(
|
|
value="session_to_token",
|
|
label="Passkey Login",
|
|
description="Signed in using a passkey",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "fingerprint",
|
|
"css_class": "text-green-600 bg-green-50",
|
|
"severity": "info",
|
|
"category": "authentication",
|
|
"sort_order": 19,
|
|
},
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# REGISTER ALL CHOICE GROUPS
|
|
# =============================================================================
|
|
|
|
# Register each choice group individually
|
|
register_choices("user_roles", user_roles.choices, "accounts", "User role classifications")
|
|
register_choices("theme_preferences", theme_preferences.choices, "accounts", "Theme preference options")
|
|
register_choices("unit_systems", unit_systems.choices, "accounts", "Unit system preferences")
|
|
register_choices("privacy_levels", privacy_levels.choices, "accounts", "Privacy level settings")
|
|
register_choices("top_list_categories", top_list_categories.choices, "accounts", "Top list category types")
|
|
register_choices("notification_types", notification_types.choices, "accounts", "Notification type classifications")
|
|
register_choices("notification_priorities", notification_priorities.choices, "accounts", "Notification priority levels")
|
|
register_choices("security_event_types", security_event_types.choices, "accounts", "Security event type classifications")
|
|
|