# ai-builder/trunk/admin/pages/account.php

AI Builder – Generate pages, blocks, images &amp; translate with AI, version trunk. 442 lines.

- Page: https://pluginprobe.com/plugins/ai-builder/trunk/code/admin/pages/account.php
- Raw: https://pluginprobe.com/plugins/ai-builder/trunk/raw/admin/pages/account.php
- Modified: 2026-04-23T10:25:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ai-builder/trunk/code/admin/pages/account.php#L10-L20`.

```php
<?php
if (!defined('ABSPATH'))
    exit; // Exit if accessed directly

// Vérifier si l'utilisateur a déjà un token JWT
$jwt_token = get_option('aibui_jwt_token', '');
$user_successful_signup = get_option('aibui_user_successful_signup', false);

// Déterminer quelle vue afficher
$show_signup = empty($jwt_token) && !$user_successful_signup;
$show_signin = empty($jwt_token) && $user_successful_signup;
$show_dashboard = !empty($jwt_token);

// Si on est sur le dashboard mais qu'il n'y a pas de token, rediriger vers la connexion
if ($show_dashboard && empty($jwt_token)) {
    $show_dashboard = false;
    $show_signin = true;
}
?>

<?php if (function_exists('aibui_render_onboarding_blocks')) { aibui_render_onboarding_blocks(); } ?>


<!-- Cloudflare Turnstile -->

<div class="ai-auth-container ai-fade-in<?php echo $show_dashboard ? ' ai-auth-container--dashboard' : ''; ?>">
    <?php if ($show_signup): ?>
        <!-- Formulaire d'inscription -->
        <div class="ai-auth-header">
            <h2>Create Account</h2>
            <p>Join us to start building amazing content</p>
        </div>

        <form class="ai-auth-form" id="signup-form">
            <div class="ai-form-group">
                <label for="signup-email">Email Address</label>
                <input type="email" id="signup-email" name="email" required>
            </div>

            <div class="ai-form-group">
                <label for="signup-password">Password</label>
                <input type="password" id="signup-password" name="password" required minlength="8">
            </div>

            <div class="ai-form-group">
                <label for="signup-confirm-password">Confirm Password</label>
                <input type="password" id="signup-confirm-password" name="confirm_password" required minlength="8">
            </div>

            <div class="ai-form-group ai-checkbox-group" style="padding: 10px;">
                <label class="ai-checkbox-label" style=" padding: 5px;">
                    <input type="checkbox" id="terms-checkbox" name="terms_accepted" required>
                    <span class="ai-checkbox-custom"></span>
                    <span class="ai-checkbox-text">
                        I agree to the
                        <a href="https://website-ai-builder.com/index.php/terms-of-use/" target="_blank"
                            class="ai-link">Terms of
                            Service</a>
                        and
                        <a href="https://website-ai-builder.com/index.php/terms-and-conditions-of-sale/" target="_blank"
                            class="ai-link">Privacy
                            Policy</a>
                    </span>
                </label>
            </div>

            <div class="ai-form-group ai-promo-wrap">
                <button type="button" class="ai-promo-toggle-btn" aria-expanded="false">
                    Add a code
                </button>
                <div class="ai-promo-panel" hidden>
                    <label for="signup-promo-input" class="ai-promo-label">Promo code</label>
                    <div class="ai-promo-row">
                        <input type="text" id="signup-promo-input" name="promo_code_input" class="ai-promo-input"
                            autocomplete="off" placeholder="Enter your code" spellcheck="false">
                        <button type="button" class="ai-promo-validate-btn">Validate</button>
                    </div>
                    <p class="ai-promo-feedback" role="status" aria-live="polite"></p>
                </div>
            </div>

            <!-- <div class="ai-form-group">
                <div id="cf-turnstile-signup" class="cf-turnstile" data-sitekey="VOTRE_CLE_SITE_TURNSTILE"></div>
            </div> -->

            <button type="submit" class="ai-submit-btn" id="signup-btn">
                <span class="ai-loading" style="display: none;"></span>
                Create Account
            </button>
        </form>

        <div class="ai-toggle-form">
            <button type="button" onclick="toggleForm('signin')">Already have an account? Sign in</button>
        </div>

    <?php elseif ($show_signin): ?>
        <!-- Formulaire de connexion -->
        <div class="ai-auth-header">
            <h2>Welcome Back</h2>
            <p>Sign in to your account</p>
        </div>

        <form class="ai-auth-form" id="signin-form">
            <div class="ai-form-group">
                <label for="signin-email" style="color: #232222; font-size: 14px;">Email Address</label>
                <input type="email" id="signin-email" name="email" style="background-color: #ffffff;" required>
            </div>

            <div class="ai-form-group">
                <label for="signin-password" style="color: #232222;">Password</label>
                <input type="password" id="signin-password" name="password" style="background-color: #ffffff;" required>
            </div>

            <div class="ai-forgot-password">
                <a href="<?php echo esc_url(admin_url('admin.php?page=aibui-reset-password')); ?>" class="ai-link">
                    Forgot your password?
                </a>
            </div>

            <!-- <div class="ai-form-group">
                <div id="cf-turnstile-signin" class="cf-turnstile" data-sitekey="VOTRE_CLE_SITE_TURNSTILE"></div>
            </div> -->

            <button type="submit" class="ai-submit-btn" id="signin-btn">
                <span class="ai-loading" style="display: none;"></span>
                Sign In
            </button>
        </form>

        <div class="ai-toggle-form">
            <button type="button" onclick="toggleForm('signup')">Don't have an account? Sign up</button>
        </div>

    <?php else: ?>
        <!-- Dashboard utilisateur connecté -->
        <div class="ai-auth-header">
            <h2>Account Dashboard</h2>
            <p>Welcome back! Here's your account overview</p>
            <p class="ai-account-email" id="account-email">Loading...</p>
        </div>

        <div class="ai-dashboard-content">
            <!-- Informations du plan -->
            <div class="ai-dashboard-card">
                <div class="ai-card-header">
                    <div class="ai-card-icon">
                        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="currentColor" stroke-width="2"
                                stroke-linejoin="round" />
                            <path d="M2 17L12 22L22 17" stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
                            <path d="M2 12L12 17L22 12" stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
                        </svg>
                    </div>
                    <div class="ai-card-title">
                        <h3>Current Plan</h3>
                        <div class="ai-plan-badge" id="plan-badge">
                            <span class="ai-loading" style="display: none;"></span>
                            Loading...
                        </div>
                    </div>
                </div>
                <div class="ai-card-content">
                    <p>Your subscription plan determines your monthly credits and features.</p>
                    <button type="button" class="ai-secondary-btn"
                        onclick="window.location.href='<?php echo esc_url(admin_url('admin.php?page=aibui-credits')); ?>'">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path
                                d="M11 4H4C3.46957 4 2.96086 4.21071 2.58579 4.58579C2.21071 4.96086 2 5.46957 2 6V20C2 20.5304 2.21071 21.0391 2.58579 21.4142C2.96086 21.7893 3.46957 22 4 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V13"
                                stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
                            <path
                                d="M18.5 2.5C18.8978 2.10217 19.4374 1.87868 20 1.87868C20.5626 1.87868 21.1022 2.10217 21.5 2.5C21.8978 2.89782 22.1213 3.43739 22.1213 4C22.1213 4.56261 21.8978 5.10217 21.5 5.5L12 15L8 16L9 12L18.5 2.5Z"
                                stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
                        </svg>
                        Change Plan
                    </button>
                </div>
            </div>

            <!-- Section Tuto -->
            <div class="ai-dashboard-card">
                <div class="ai-card-header">
                    <div class="ai-card-icon">
                        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path
                                d="M4 19.5V5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V19.5C20 20.3284 19.3284 21 18.5 21H5.5C4.67157 21 4 20.3284 4 19.5Z"
                                stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
                            <path d="M8 8H16" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
                            <path d="M8 12H16" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
                            <path d="M8 16H12" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
                        </svg>
                    </div>
                    <div class="ai-card-title">
                        <h3>How to use the tool?</h3>
                        <div class="ai-plan-badge tuto">
                            Tutorial
                        </div>
                    </div>
                </div>
                <div class="ai-card-content">
                    <p>Discover all the features and learn how to use AI Builder efficiently.</p>
                    <button type="button" class="ai-secondary-btn"
                        onclick="window.location.href='<?php echo esc_url(admin_url('admin.php?page=aibui-tuto')); ?>'">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M12 4V20" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M5 12H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                        </svg>
                        See Tutorial
                    </button>
                </div>
            </div>

            <!-- Informations des crédits -->
            <div class="ai-dashboard-card">
                <div class="ai-card-header">
                    <div class="ai-card-icon">
                        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" />
                            <path d="M12 6V12L16 14" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                        </svg>
                    </div>
                    <div class="ai-card-title">
                        <h3>AI Credits</h3>
                        <div class="ai-credits-display" id="credits-display">
                            <span class="ai-loading" style="display: none;"></span>
                            Loading...
                        </div>
                    </div>
                </div>
                <div class="ai-card-content">
                    <div class="ai-credits-breakdown" id="credits-breakdown">
                        <div class="ai-credit-item">
                            <span class="ai-credit-label">Free credits:</span>
                            <span class="ai-credit-value" id="creation-credits">-</span>
                        </div>
                        <div class="ai-credit-item">
                            <span class="ai-credit-label">Monthly subscription:</span>
                            <span class="ai-credit-value" id="monthly-credits">-</span>
                        </div>
                        <div class="ai-credit-item">
                            <span class="ai-credit-label">Paid credits:</span>
                            <span class="ai-credit-value" id="paid-credits">-</span>
                        </div>
                    </div>
                    <button type="button" class="ai-primary-btn"
                        onclick="window.location.href='<?php echo esc_url(admin_url('admin.php?page=aibui-credits')); ?>'">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M12 2V6" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M12 18V22" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M4.93 4.93L7.76 7.76" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M16.24 16.24L19.07 19.07" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M2 12H6" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M18 12H22" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M4.93 19.07L7.76 16.24" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M16.24 7.76L19.07 4.93" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                        </svg>
                        Buy More Credits
                    </button>
                </div>
            </div>

            <!-- Feedback / Help us improve -->
            <div class="ai-dashboard-card">
                <div class="ai-card-header">
                    <div class="ai-card-icon">
                        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M3 11C3 6.58172 6.58172 3 11 3H13C17.4183 3 21 6.58172 21 11V21H11C6.58172 21 3 17.4183 3 13V11Z"
                                stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
                            <path d="M8 10H16" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
                            <path d="M8 14H13" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
                        </svg>
                    </div>
                    <div class="ai-card-title">
                        <h3>Help us improve</h3>
                        <div class="ai-plan-badge tuto">
                            Feedback
                        </div>
                    </div>
                </div>
                <div class="ai-card-content">
                    <p>Your feedback shapes the next versions of AI Builder. Share what you love, what's missing or any bug you spotted — it only takes a minute.</p>
                    <a href="https://tally.so/r/ob0EaM" target="_blank" rel="noopener noreferrer"
                        class="ai-secondary-btn ai-feedback-btn">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M21 15C21 15.5304 20.7893 16.0391 20.4142 16.4142C20.0391 16.7893 19.5304 17 19 17H7L3 21V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15Z"
                                stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
                        </svg>
                        Share your feedback
                        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"
                            style="margin-left: 2px;">
                            <path d="M7 17L17 7" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                            <path d="M8 7H17V16" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" />
                        </svg>
                    </a>
                </div>
            </div>

            <!-- Actions du compte -->
            <div class="ai-dashboard-actions">
                <button type="button" class="ai-submit-btn ai-signout-btn" onclick="signOut()">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path
                            d="M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9"
                            stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
                        <path d="M16 17L21 12L16 7" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                            stroke-linejoin="round" />
                        <path d="M21 12H9" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                            stroke-linejoin="round" />
                    </svg>
                    Sign Out
                </button>
            </div>
        </div>
    <?php endif; ?>

    <div id="message-container"></div>
</div>

<!-- Formulaire caché pour l'inscription -->
<div class="ai-form-hidden" id="hidden-signup-form">
    <div class="ai-auth-header">
        <h2>Create Account</h2>
        <p>Join us to start building amazing content</p>
    </div>

    <form class="ai-auth-form" id="hidden-signup-form-element">
        <div class="ai-form-group">
            <label for="hidden-signup-email" style="color: #232222; font-size: 14px;">Email Address</label>
            <input type="email" id="hidden-signup-email" name="email" style="background-color: #ffffff;" required>
        </div>

        <div class="ai-form-group">
            <label for="hidden-signup-password" style="color: #232222; font-size: 14px;">Password</label>
            <input type="password" id="hidden-signup-password" name="password" style="background-color: #ffffff;"
                required minlength="8">
        </div>

        <div class="ai-form-group">
            <label for="hidden-signup-confirm-password" style="color: #232222; font-size: 14px;">Confirm
                Password</label>
            <input type="password" id="hidden-signup-confirm-password" name="confirm_password"
                style="background-color: #ffffff;" required minlength="8">
        </div>

        <div class="ai-form-group ai-checkbox-group" style="padding: 10px;">
            <label class="ai-checkbox-label" style=" padding: 5px;">
                <input type="checkbox" id="terms-checkbox" name="terms_accepted" required>
                <span class="ai-checkbox-custom"></span>
                <span class="ai-checkbox-text">
                    I agree to the
                    <a href="https://website-ai-builder.com/index.php/terms-of-use/" target="_blank"
                        class="ai-link">Terms of
                        Service</a>
                    and
                    <a href="https://website-ai-builder.com/index.php/terms-and-conditions-of-sale/" target="_blank"
                        class="ai-link">Privacy
                        Policy</a>
                </span>
            </label>
        </div>

        <div class="ai-form-group ai-promo-wrap">
            <button type="button" class="ai-promo-toggle-btn" aria-expanded="false">
                Add a code
            </button>
            <div class="ai-promo-panel" hidden>
                <label for="hidden-signup-promo-input" class="ai-promo-label">Promo code</label>
                <div class="ai-promo-row">
                    <input type="text" id="hidden-signup-promo-input" name="promo_code_input" class="ai-promo-input"
                        autocomplete="off" placeholder="Enter your code" spellcheck="false">
                    <button type="button" class="ai-promo-validate-btn">Validate</button>
                </div>
                <p class="ai-promo-feedback" role="status" aria-live="polite"></p>
            </div>
        </div>

        <!-- <div class="ai-form-group">
            <div id="cf-turnstile-hidden-signup" class="cf-turnstile" data-sitekey="VOTRE_CLE_SITE_TURNSTILE"></div>
        </div> -->

        <button type="submit" class="ai-submit-btn" id="hidden-signup-btn">
            <span class="ai-loading" style="display: none;"></span>
            Create Account
        </button>
    </form>

    <div class="ai-toggle-form">
        <button type="button" onclick="toggleForm('signin')">Already have an account? Sign in</button>
    </div>
</div>

<!-- Formulaire caché pour la connexion -->
<div class="ai-form-hidden" id="hidden-signin-form">
    <div class="ai-auth-header">
        <h2>Welcome Back</h2>
        <p>Sign in to your account</p>
    </div>

    <form class="ai-auth-form" id="hidden-signin-form-element">
        <div class="ai-form-group">
            <label for="hidden-signin-email" style="color: #232222; font-size: 14px;">Email Address</label>
            <input type="email" id="hidden-signin-email" name="email" style="background-color: #ffffff;" required>
        </div>

        <div class="ai-form-group">
            <label for="hidden-signin-password" style="color: #232222; font-size: 14px;">Password</label>
            <input type="password" id="hidden-signin-password" name="password" style="background-color: #ffffff;"
                required>
        </div>

        <div class="ai-forgot-password">
            <a href="<?php echo esc_url(admin_url('admin.php?page=aibui-reset-password')); ?>" class="ai-link">
                Forgot your password?
            </a>
        </div>

        <!-- <div class="ai-form-group">
            <div id="cf-turnstile-hidden-signin" class="cf-turnstile" data-sitekey="VOTRE_CLE_SITE_TURNSTILE"></div>
        </div> -->

        <button type="submit" class="ai-submit-btn" id="hidden-signin-btn">
            <span class="ai-loading" style="display: none;"></span>
            Sign In
        </button>
    </form>

    <div class="ai-toggle-form">
        <button type="button" onclick="toggleForm('signup')">Don't have an account? Sign up</button>
    </div>
</div>
```
