Skip to content

Commit c3ad807

Browse files
committed
fix(hub): improve login dark mode
1 parent a2dc970 commit c3ad807

2 files changed

Lines changed: 33 additions & 25 deletions

File tree

runtime/hub/frontend/packages/login-css/src/login.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
* small login bundle doesn't need.
4141
*/
4242
@import "tailwindcss" source(none);
43+
@custom-variant dark (&:where([data-bs-theme="dark"], [data-bs-theme="dark"] *));
4344
@source "../../../templates/**/*.html";

runtime/hub/frontend/templates/login.html

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,16 @@ <h2 class="text-3xl md:text-4xl font-bold text-white mb-4">AUP Learning Cloud</h
9696
href='{{ authenticator_login_url | safe }}'>
9797
Sign in with {{ login_service }}
9898
</a>
99+
{% if 'github' in login_service|lower %}
100+
<p class="text-sm text-blue-100 mt-3 mb-0">Start a free 2-hour trial with GitHub sign-in.</p>
101+
{% endif %}
99102
{% endif %}
100103
</div>
101104
</div>
102-
<div class="w-full md:w-3/5 flex items-center justify-center p-6 md:p-16">
105+
<div class="w-full md:w-3/5 flex items-center justify-center p-6 md:p-16 bg-gray-50 dark:bg-gray-950">
103106
<div class="w-full max-w-md">
104107
{% block login_container %}
105-
<div id="announcement-box" class="bg-blue-50 text-blue-900 border border-blue-200 p-4 mb-6 rounded-lg hidden"></div>
108+
<div id="announcement-box" class="bg-blue-50 text-blue-900 border border-blue-200 dark:bg-blue-950 dark:text-blue-100 dark:border-blue-800 p-4 mb-6 rounded-lg hidden"></div>
106109

107110
<script>
108111
fetch("{{ static_url('announcement.txt') }}")
@@ -111,26 +114,28 @@ <h2 class="text-3xl md:text-4xl font-bold text-white mb-4">AUP Learning Cloud</h
111114
return resp.text();
112115
})
113116
.then(data => {
114-
if (data && data.trim()) {
115-
const box = document.getElementById("announcement-box");
116-
box.innerHTML = data;
117-
box.classList.remove("hidden");
118-
}
117+
const announcement = data.trim();
118+
const announcementText = announcement.replace(/<[^>]*>/g, "").trim().toLowerCase();
119+
if (!announcement || /^hello,\s*world!?$/.test(announcementText)) return;
120+
121+
const box = document.getElementById("announcement-box");
122+
box.innerHTML = announcement;
123+
box.classList.remove("hidden");
119124
})
120125
.catch(err => {
121126
console.warn("External announcement.txt load fail", err);
122127
});
123128
</script>
124-
<div class="bg-white rounded-xl shadow-lg p-8">
129+
<div class="bg-white dark:bg-gray-900 border border-transparent dark:border-gray-700 rounded-xl shadow-lg dark:shadow-black/40 p-8">
125130
<div class="text-center mb-8">
126-
<h1 class="text-2xl font-bold text-gray-800">Login to AUP Learning Cloud</h1>
131+
<h1 class="text-2xl font-bold text-gray-800 dark:text-gray-50">Login to AUP Learning Cloud</h1>
127132
{% if authenticator_mode == 'dummy' %}
128-
<p class="text-sm text-orange-600 mt-2">⚠️ Development Mode - Any username/password accepted</p>
133+
<p class="text-sm text-orange-600 dark:text-orange-300 mt-2">⚠️ Development Mode - Any username/password accepted</p>
129134
{% endif %}
130135
</div>
131136

132137
{% if login_error %}
133-
<p class="text-red-500 font-medium mb-4 text-center">{{ login_error }}</p>
138+
<p class="text-red-500 dark:text-red-300 font-medium mb-4 text-center">{{ login_error }}</p>
134139
{% endif %}
135140

136141
{% if authenticator_mode == 'dummy' %}
@@ -139,21 +144,21 @@ <h1 class="text-2xl font-bold text-gray-800">Login to AUP Learning Cloud</h1>
139144
<input type="hidden" name="_xsrf" value="{{ xsrf }}" />
140145

141146
<div>
142-
<label for="username_input" class="block text-sm font-medium text-gray-700 mb-1">Username</label>
147+
<label for="username_input" class="block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1">Username</label>
143148
<input id="username_input" type="text" autocapitalize="off" autocorrect="off" autocomplete="username"
144149
name="username" value="{{ username }}" autofocus="autofocus"
145-
class="block w-full pl-3 pr-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
150+
class="block w-full pl-3 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
146151
</div>
147152

148153
<div>
149-
<label for="password_input" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
154+
<label for="password_input" class="block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1">Password</label>
150155
<input id="password_input" type="password" autocomplete="current-password" name="password"
151-
class="block w-full pl-3 pr-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
156+
class="block w-full pl-3 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
152157
</div>
153158

154159
<div class="mt-6">
155160
<button id="login_submit" type="submit"
156-
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition duration-300">
161+
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-offset-gray-900 transition duration-300">
157162
Login
158163
</button>
159164
</div>
@@ -167,12 +172,13 @@ <h1 class="text-2xl font-bold text-gray-800">Login to AUP Learning Cloud</h1>
167172
Form POST actions DO need urlencode due to different browser/server handling. -->
168173
<div class="mb-6">
169174
<a href="{{ base_url }}oauth_login?next={{ next }}"
170-
class="w-full flex justify-center items-center py-3 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition duration-300">
175+
class="w-full flex justify-center items-center py-3 px-4 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-50 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-offset-gray-900 transition duration-300">
171176
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
172177
<path fill-rule="evenodd" d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z" clip-rule="evenodd"/>
173178
</svg>
174179
Sign in with GitHub
175180
</a>
181+
<p class="text-sm text-gray-600 dark:text-gray-300 text-center mt-3 mb-0">Start a free 2-hour trial with GitHub sign-in.</p>
176182
</div>
177183

178184
{% else %}
@@ -181,20 +187,21 @@ <h1 class="text-2xl font-bold text-gray-800">Login to AUP Learning Cloud</h1>
181187
<!-- NOTE: Do NOT add "| urlencode" here - see comment above for explanation -->
182188
<div class="mb-6">
183189
<a href="{{ base_url }}github/oauth_login?next={{ next }}"
184-
class="w-full flex justify-center items-center py-3 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition duration-300">
190+
class="w-full flex justify-center items-center py-3 px-4 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-50 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-offset-gray-900 transition duration-300">
185191
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
186192
<path fill-rule="evenodd" d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z" clip-rule="evenodd"/>
187193
</svg>
188194
Sign in with GitHub
189195
</a>
196+
<p class="text-sm text-gray-600 dark:text-gray-300 text-center mt-3 mb-0">Start a free 2-hour trial with GitHub sign-in.</p>
190197
</div>
191198

192199
<div class="relative mb-6">
193200
<div class="absolute inset-0 flex items-center">
194-
<div class="w-full border-t border-gray-300"></div>
201+
<div class="w-full border-t border-gray-300 dark:border-gray-700"></div>
195202
</div>
196203
<div class="relative flex justify-center text-sm">
197-
<span class="px-2 bg-white text-gray-500">Or use local account</span>
204+
<span class="px-2 bg-white dark:bg-gray-900 text-gray-500 dark:text-gray-300">Or use local account</span>
198205
</div>
199206
</div>
200207

@@ -203,21 +210,21 @@ <h1 class="text-2xl font-bold text-gray-800">Login to AUP Learning Cloud</h1>
203210
<input type="hidden" name="_xsrf" value="{{ xsrf }}" />
204211

205212
<div>
206-
<label for="username_input" class="block text-sm font-medium text-gray-700 mb-1">Username</label>
213+
<label for="username_input" class="block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1">Username</label>
207214
<input id="username_input" type="text" autocapitalize="off" autocorrect="off" autocomplete="username"
208215
name="username" value="{{ username }}" autofocus="autofocus"
209-
class="block w-full pl-3 pr-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
216+
class="block w-full pl-3 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
210217
</div>
211218

212219
<div>
213-
<label for="password_input" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
220+
<label for="password_input" class="block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1">Password</label>
214221
<input id="password_input" type="password" autocomplete="current-password" name="password"
215-
class="block w-full pl-3 pr-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
222+
class="block w-full pl-3 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
216223
</div>
217224

218225
<div class="mt-6">
219226
<button id="login_submit" type="submit"
220-
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition duration-300">
227+
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-offset-gray-900 transition duration-300">
221228
Login
222229
</button>
223230
</div>

0 commit comments

Comments
 (0)