import os
import re

auth_files = [
    'src/app/auth/login/page.tsx',
    'src/app/forgot-password/page.tsx',
    'src/app/forgot-password/reset-password/page.tsx',
    'src/app/profile/edit/page.tsx'
]

for filepath in auth_files:
    if not os.path.exists(filepath):
        continue
    with open(filepath, 'r') as f:
        content = f.read()
    
    # We want to replace </FormLabel> with <span className="text-red-500 ml-1">*</span></FormLabel>
    # ONLY if it doesn't already have an asterisk span.
    # A safe regex: find </FormLabel> that is NOT preceded by </span>
    new_content = re.sub(r'(?<!</span>)</FormLabel>', r'<span className="text-red-500 ml-1">*</span></FormLabel>', content)
    
    if new_content != content:
        with open(filepath, 'w') as f:
            f.write(new_content)
        print(f"Updated {filepath}")
