|
6 | 6 | <title>Scratch Auth | Login & Dashboard | Coding Hut</title>
|
7 | 7 | <style>
|
8 | 8 | body {
|
9 |
| - font-family: Sans-Serif; |
| 9 | + font-family: 'Arial', sans-serif; |
10 | 10 | margin: 0;
|
11 | 11 | padding: 0;
|
12 | 12 | background-color: #f4f4f4;
|
|
16 | 16 | background-color: #c04d4d;
|
17 | 17 | color: white;
|
18 | 18 | padding: 20px;
|
| 19 | + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); |
19 | 20 | }
|
20 | 21 | .content {
|
21 | 22 | padding: 20px;
|
| 23 | + max-width: 600px; |
| 24 | + margin: auto; |
| 25 | + background-color: white; |
| 26 | + border-radius: 8px; |
| 27 | + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
22 | 28 | }
|
23 | 29 | .message {
|
24 | 30 | color: red;
|
25 | 31 | font-weight: bold;
|
| 32 | + margin-top: 10px; |
26 | 33 | }
|
27 | 34 | button {
|
28 |
| - padding: 10px; |
| 35 | + padding: 10px 20px; |
29 | 36 | margin: 10px;
|
30 | 37 | font-size: 16px;
|
| 38 | + border: none; |
| 39 | + border-radius: 5px; |
| 40 | + cursor: pointer; |
| 41 | + background-color: #c04d4d; |
| 42 | + color: white; |
| 43 | + transition: background-color 0.3s; |
| 44 | + } |
| 45 | + button:hover { |
| 46 | + background-color: #a03a3a; |
| 47 | + } |
| 48 | + p { |
| 49 | + line-height: 1.5; |
| 50 | + } |
| 51 | + a { |
| 52 | + text-decoration: none; |
31 | 53 | }
|
32 | 54 | </style>
|
33 | 55 | <script>
|
|
45 | 67 | }, 2000);
|
46 | 68 | }
|
47 | 69 |
|
48 |
| - // Simulate checking if the user is logged in |
49 | 70 | function checkAuth() {
|
50 | 71 | const urlParams = new URLSearchParams(window.location.search);
|
51 | 72 | const authSuccess = urlParams.get('success'); // Example: Scratch Auth might return '?success=true'
|
52 |
| - const username = urlParams.get('username') |
53 |
| - localStorage.setItem('username', username) |
| 73 | + const username = urlParams.get('username'); |
| 74 | + if (username) { |
| 75 | + localStorage.setItem('username', username); |
| 76 | + } |
54 | 77 |
|
55 | 78 | if (authSuccess === 'true') {
|
56 |
| - // Redirect to index.html if login was successful |
57 | 79 | localStorage.setItem('loggedIn', 'true');
|
58 | 80 | window.location.href = 'index.html';
|
59 | 81 | }
|
60 | 82 | }
|
61 | 83 |
|
62 |
| - // Run this check when the page loads |
63 | 84 | window.onload = checkAuth;
|
64 | 85 | </script>
|
65 | 86 | </head>
|
66 | 87 | <body>
|
67 |
| - <div class="header"><h1>Scratch Authentication</h1></div> |
| 88 | + <div class="header"> |
| 89 | + <h1>Scratch Authentication</h1> |
| 90 | + </div> |
68 | 91 | <div class="content">
|
69 | 92 | <h2>Welcome! Please log in to continue.</h2>
|
70 | 93 | <button onclick="registerUser()">Register</button>
|
71 |
| - <p id="message" class="message"></p> |
| 94 | + <p id="message" class="message" aria-live="polite"></p> |
72 | 95 | <p>
|
73 | 96 | Please note: You will be redirected to an external site (Scratch Auth) for authentication. Once there,
|
74 | 97 | choose the "Cloud Data" option for the quickest sign-in method.
|
75 | 98 | </p>
|
76 | 99 | <p>
|
77 |
| - If you are unable to use the "Cloud Data" option, other sign-in methods are available on Scratch Auth's page, for example profile commenting. |
| 100 | + If you are unable to use the "Cloud Data" option, other sign-in methods are available on Scratch Auth's page, for example, profile commenting. |
78 | 101 | </p>
|
79 |
| - |
80 |
| -<a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new"> |
81 |
| - <button>Having trouble signing in? Report an issue</button> |
82 |
| -</a> |
83 |
| - |
| 102 | + <a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new"> |
| 103 | + <button>Having trouble signing in? Report an issue</button> |
| 104 | + </a> |
84 | 105 | </div>
|
85 | 106 | </body>
|
86 | 107 | </html>
|
0 commit comments