<?php
/**
 * HuSNS - 移动端账号安全设置页面
 */
$userId = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null;
if (!$userId) {
    $this->assign('showLoginModal', true);
}

$currentPage = 'privacy-security';
$pageType = 'privacy';
$bodyClass = 'privacy-page security-page';
$headerTitle = '账号安全';

$pageCssFiles = [$this->themeUrl() . '/app/css/privacy.css'];
$pageJsFiles = [$this->themeUrl() . '/app/js/privacy-security.js'];

$this->assign('pageCssFiles', $pageCssFiles);
$this->assign('pageJsFiles', $pageJsFiles);

$this->setLayout('app');
?>

<div class="privacy-content">
    <!-- 修改密码 -->
    <div class="privacy-section">
        <div class="privacy-section-title">修改密码</div>
        
        <div class="security-form">
            <div class="form-group">
                <label class="form-label">当前密码</label>
                <input type="password" id="currentPassword" class="form-input" placeholder="请输入当前密码">
            </div>
            <div class="form-group">
                <label class="form-label">新密码</label>
                <input type="password" id="newPassword" class="form-input" placeholder="请输入新密码（至少6位）">
            </div>
            <div class="form-group">
                <label class="form-label">确认密码</label>
                <input type="password" id="confirmPassword" class="form-input" placeholder="请再次输入新密码">
            </div>
            <button class="form-button" id="changePasswordBtn">修改密码</button>
        </div>
    </div>
    
    <!-- 绑定管理 -->
    <div class="privacy-section">
        <div class="privacy-section-title">绑定管理</div>
        
        <div class="binding-list">
            <div class="binding-item">
                <div class="binding-info">
                    <div class="binding-icon">📱</div>
                    <div class="binding-detail">
                        <div class="binding-name">手机号码</div>
                        <div class="binding-value" id="mobileValue">未绑定</div>
                    </div>
                </div>
                <button class="binding-btn" id="bindMobileBtn">绑定</button>
            </div>
            
            <div class="binding-item">
                <div class="binding-info">
                    <div class="binding-icon">📧</div>
                    <div class="binding-detail">
                        <div class="binding-name">邮箱地址</div>
                        <div class="binding-value" id="emailValue">未绑定</div>
                    </div>
                </div>
                <button class="binding-btn" id="bindEmailBtn">绑定</button>
            </div>
        </div>
    </div>
    
    <!-- 登录设备管理 -->
    <div class="privacy-section">
        <div class="privacy-section-title">登录设备</div>
        
        <div class="device-list" id="deviceList">
            <div class="loading-tip">加载中...</div>
        </div>
        
        <div class="empty-state" id="deviceEmptyState" style="display: none;">
            <div class="empty-icon">📱</div>
            <div class="empty-text">暂无登录设备记录</div>
        </div>
    </div>
    
    <!-- 安全提醒 -->
    <div class="security-tip">
        <div class="tip-icon">🔒</div>
        <div class="tip-content">
            <div class="tip-title">安全建议</div>
            <div class="tip-text">建议定期修改密码，并开启双重验证以保障账号安全</div>
        </div>
    </div>
</div>