pvanand commited on
Commit
867f1cf
·
verified ·
1 Parent(s): 82b0193

Upload index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +84 -0
templates/index.html ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>User Authentication and Validation Check</title>
7
+ <style>
8
+ body, html {
9
+ margin: 0;
10
+ padding: 0;
11
+ height: 100%;
12
+ overflow: hidden;
13
+ }
14
+ iframe {
15
+ width: 100vw;
16
+ height: 100vh;
17
+ border: none;
18
+ }
19
+ #debug {
20
+ position: fixed;
21
+ top: 0;
22
+ right: 0;
23
+ background: rgba(0,0,0,0.7);
24
+ color: white;
25
+ padding: 10px;
26
+ max-width: 300px;
27
+ max-height: 200px;
28
+ overflow: auto;
29
+ }
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <div id="content"></div>
34
+ <div id="debug"></div>
35
+
36
+ <script>
37
+ const content = document.getElementById('content');
38
+ const debugElement = document.getElementById('debug');
39
+
40
+ function debug(message) {
41
+ console.log(message);
42
+ debugElement.innerHTML += message + '<br>';
43
+ }
44
+
45
+ function showURL(url) {
46
+ debug(`Showing URL: ${url}`);
47
+ content.innerHTML = `<iframe src="${url}"></iframe>`;
48
+ }
49
+
50
+ function getCookie(name) {
51
+ const value = `; ${document.cookie}`;
52
+ const parts = value.split(`; ${name}=`);
53
+ if (parts.length === 2) return parts.pop().split(';').shift();
54
+ }
55
+
56
+ async function checkUserStatus() {
57
+ try {
58
+ debug('Starting checkUserStatus');
59
+ const token = new URLSearchParams(window.location.hash.slice(1)).get('access_token') || getCookie('auth_token');
60
+ debug(`Token: ${token ? 'exists' : 'not found'}`);
61
+
62
+ const response = await fetch('/check_status', {
63
+ method: 'POST',
64
+ headers: {
65
+ 'Content-Type': 'application/json',
66
+ },
67
+ body: JSON.stringify({ token: token }),
68
+ });
69
+
70
+ debug(`Received response from server`);
71
+ const data = await response.json();
72
+ debug(`Response data: ${JSON.stringify(data)}`);
73
+ showURL(data.url);
74
+ } catch (error) {
75
+ debug(`Error: ${error.message}`);
76
+ showURL('https://www.login.com');
77
+ }
78
+ }
79
+
80
+ debug('Script started');
81
+ checkUserStatus();
82
+ </script>
83
+ </body>
84
+ </html>