File size: 5,103 Bytes
055e879
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14cf53f
055e879
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Verify Admin | Fuse Cafe | Roblox</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="components/navbar.js"></script>
    <script src="components/sidebar.js"></script>
</head>
<body class="bg-gray-50">
    <custom-navbar></custom-navbar>
    <custom-sidebar></custom-sidebar>

    <main class="ml-0 md:ml-64 pt-16 px-4 min-h-screen bg-[#f9f5f0]">
        <div class="max-w-md mx-auto py-12 animate__animated animate__fadeIn">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden p-8">
                <div class="text-center mb-8">
                    <h1 class="text-3xl font-bold text-[#6F4E37] mb-2">Verify Your Account</h1>
                    <p class="text-[#5a3c2b]">Enter the verification code sent to your email</p>
                </div>
                
                <form id="verify-form" class="space-y-6">
                    <div>
                        <label for="verification-code" class="block text-sm font-medium text-[#5a3c2b]">Verification Code</label>
                        <input type="text" id="verification-code" required class="mt-1 block w-full rounded-md border-[#d4b999] shadow-sm focus:border-[#6F4E37] focus:ring focus:ring-[#6F4E37] focus:ring-opacity-50 p-2 bg-[#f9f5f0] transition-all duration-300" placeholder="123456">
                    </div>
                    
                    <div>
                        <button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-[#6F4E37] hover:bg-[#5a3c2b] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#6F4E37] transition-all duration-300 transform hover:scale-[1.01]">
                            Verify Account
                        </button>
                    </div>
                    
                    <div class="text-center text-sm text-[#5a3c2b]">
                        Didn't receive code? <button type="button" id="resend-code" class="font-medium text-[#6F4E37] hover:text-[#5a3c2b]">Resend Code</button>
                    </div>
                </form>
            </div>
        </div>
    </main>

    <script>
        feather.replace();
        
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.getElementById('verify-form');
            const resendBtn = document.getElementById('resend-code');
            const pendingAdmin = JSON.parse(sessionStorage.getItem('pendingAdmin'));
            
            if (!pendingAdmin) {
                window.location.href = 'admin-signup.html';
                return;
            }
            
            form.addEventListener('submit', function(e) {
                e.preventDefault();
                
                const code = document.getElementById('verification-code').value;
                
                if (code == pendingAdmin.verificationCode) {
                    // Save admin to local storage
                    const fuseCafeData = JSON.parse(localStorage.getItem('fuseCafeData')) || {};
                    fuseCafeData.admins = fuseCafeData.admins || [];
                    
                    // Add new admin
                    fuseCafeData.admins.push({
                        username: pendingAdmin.username,
                        email: pendingAdmin.email,
                        password: pendingAdmin.password,
                        useAuthApp: pendingAdmin.useAuthApp,
                        verified: true,
                        createdAt: new Date().toISOString()
                    });
                    
                    localStorage.setItem('fuseCafeData', JSON.stringify(fuseCafeData));
                    sessionStorage.removeItem('pendingAdmin');
                    
                    alert('Account verified successfully! You can now log in.');
                    window.location.href = 'admin-login.html';
                } else {
                    alert('Invalid verification code. Please try again.');
                }
            });
            
            resendBtn.addEventListener('click', function() {
                // Generate new code
                const newCode = Math.floor(100000 + Math.random() * 900000);
                pendingAdmin.verificationCode = newCode;
                sessionStorage.setItem('pendingAdmin', JSON.stringify(pendingAdmin));
                
                alert(`New verification code sent to ${pendingAdmin.email}. Code: ${newCode}`);
            });
        });
    </script>
    <script src="https://cdn.jsdelivr.net/npm/emailjs-com@3.2.0/dist/email.min.js"></script>
    <script src="script.js"></script>
</body>
</html>