|
120 | 120 | window.location.href = 'index.html'; // Redirect to the dashboard if already logged in
|
121 | 121 | }
|
122 | 122 | checkAuth()
|
| 123 | +const user = localStorage.getItem('username') |
| 124 | +const text = document.getElementById('text'); |
| 125 | +const loggedIn = document.getElementById('loggedIn') |
| 126 | + if (username) { |
| 127 | + text.style.display = 'none'; |
| 128 | + loggedIn.style.display = 'block'; |
| 129 | + loggedIn.textContent = `Welcome to your account ${username}!` |
| 130 | + } |
123 | 131 | </script>
|
124 | 132 | </head>
|
125 | 133 | <body>
|
126 |
| - <div class="header"> |
| 134 | + <div id="text" class="header"> |
127 | 135 | <h1>Scratch Authentication</h1>
|
128 | 136 | </div>
|
| 137 | + <div id="loggedIn" class="header"></div> |
129 | 138 |
|
130 |
| - <div class="content"> |
| 139 | + <div id="text" class="content"> |
131 | 140 | <h2>Welcome! Please log in to continue.</h2>
|
132 | 141 | <button onclick="registerScratchAuth()">Register With ScratchAuth</button>
|
133 |
| - <p id="message" class="message" aria-live="polite"></p> |
134 |
| - <p> |
| 142 | + <p id="message" id="text" class="message" aria-live="polite"></p> |
| 143 | + <p id="text"> |
135 | 144 | Please note: You will be redirected to an external site (ScratchAuth) for authentication. Once there,
|
136 | 145 | choose the "Cloud Data" option for the quickest sign-in method.
|
137 |
| - </p> |
138 |
| - <p> |
139 |
| - 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. |
140 |
| - </p> |
| 146 | + |
| 147 | + 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.</p> |
141 | 148 |
|
142 | 149 | </div>
|
143 | 150 |
|
144 |
| - <div class="container"> |
| 151 | + <div id="text" class="container"> |
145 | 152 | <h2>Login Using APIAuth</h2>
|
146 | 153 | <button onclick="registerApiAuth()">Login With APIAuth (Made by <a href="https://scratch.mit.edu/users/kRxZy_kRxZy/" target="_blank" style="color: black">kRxZy_kRxZy</a>)</button>
|
147 | 154 | </div>
|
148 |
| - <div class="container"><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new"> |
| 155 | + <div id="text" class="container"><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new"> |
149 | 156 | <button>Having trouble signing in? Report an issue</button></a><div>
|
150 | 157 | </body>
|
151 | 158 | </html>
|
0 commit comments