-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin: Log in page #2371
Admin: Log in page #2371
Changes from all commits
ef113e7
a56e42d
6de5abe
a0bd133
f8b67fe
27bbf27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
@import "../variables.css"; | ||
|
||
/* CSS Variable overrides */ | ||
|
||
html[data-theme="light"], | ||
:root { | ||
--primary: #ffffff; | ||
--secondary: var(--dark-color); | ||
--link-fg: #ffffff; | ||
--body-quiet-color: var(--dark-color); | ||
--button-bg: #ffffff; | ||
} | ||
|
||
/* Buttons */ | ||
/* Primary Button: Use all three classes: btn btn-lg btn-primary */ | ||
/* Outline Primary Button: Use all three classes: btn btn-lg btn-outline-primary */ | ||
|
@@ -20,11 +31,13 @@ | |
color: var(--primary-color); | ||
} | ||
|
||
.login input[type="submit"], | ||
.btn.btn-lg.btn-primary { | ||
background-color: var(--primary-color); | ||
} | ||
|
||
.btn.btn-lg.btn-primary, | ||
.login input[type="submit"], | ||
.btn.btn-lg.btn-outline-primary { | ||
border-color: var(--primary-color); | ||
border-width: 2px; | ||
|
@@ -36,6 +49,7 @@ | |
} | ||
|
||
.btn.btn-lg.btn-primary:hover, | ||
.login input[type="submit"]:hover, | ||
.btn.btn-lg.btn-outline-primary:hover { | ||
background-color: var(--hover-color); | ||
border-color: var(--hover-color); | ||
|
@@ -48,7 +62,11 @@ | |
.btn-outline-dark:focus, | ||
.btn-outline-dark:focus-visible, | ||
.btn-outline-light:focus, | ||
.btn-ouline-dark:focus-visible { | ||
.btn-ouline-dark:focus-visible, | ||
input[type="text"]:focus, | ||
input[type="password"]:focus, | ||
.google-login-btn a:focus, | ||
.login input[type="submit"]:focus { | ||
outline: 3px solid var(--focus-color) !important; | ||
outline-offset: 2px !important; | ||
box-shadow: none !important; /* override CA State Web Template */ | ||
|
@@ -61,19 +79,13 @@ | |
letter-spacing: calc(var(--font-size-20px) * var(--letter-spacing-2)); | ||
} | ||
|
||
html[data-theme="light"], | ||
:root { | ||
--primary: #ffffff; | ||
--secondary: var(--dark-color); | ||
--link-fg: #ffffff; | ||
--body-quiet-color: var(--dark-color); | ||
} | ||
|
||
#user-tools, | ||
#logout-form button { | ||
#logout-form button, | ||
.login .submit-row input[type="submit"] { | ||
text-transform: unset; | ||
} | ||
|
||
/* Eligibility Page */ | ||
.checkbox-parent .form-group:last-of-type .col-12 { | ||
display: flex; | ||
flex-direction: row-reverse; | ||
|
@@ -90,9 +102,94 @@ html[data-theme="light"], | |
row-gap: 1rem; | ||
} | ||
|
||
/* Enrollment */ | ||
/* Enrollment Page*/ | ||
iframe.card-collection { | ||
border: 0px; | ||
width: 100%; | ||
height: 60vh; | ||
} | ||
|
||
/* Login Page */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is copied + pasted from https://github.com/django/django/blob/9ca1f6eff6f19d1ae074d289c6c4209073351805/django/contrib/admin/static/admin/css/login.css#L1 except with a few modifications necessary for the design of our page. |
||
.login #header { | ||
padding: 0 !important; | ||
} | ||
|
||
.login #branding { | ||
flex-direction: column; | ||
width: 100%; | ||
} | ||
|
||
.login #container { | ||
background: var(--body-bg); | ||
border: 1px solid var(--hairline-color); | ||
overflow: hidden; | ||
width: 28em; | ||
min-width: 300px; | ||
margin: 100px auto; | ||
height: auto; | ||
} | ||
|
||
.login #login-form { | ||
display: grid; | ||
gap: 1em; | ||
} | ||
|
||
.login .form-row label { | ||
display: block; | ||
line-height: 2em; | ||
} | ||
|
||
.login .form-row #id_username, | ||
.login .form-row #id_password { | ||
padding: 8px; | ||
width: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
.login .password-reset-link { | ||
text-align: center; | ||
} | ||
Comment on lines
+149
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is directly from https://github.com/django/django/blob/9ca1f6eff6f19d1ae074d289c6c4209073351805/django/contrib/admin/static/admin/css/login.css#L59 but I don't know how to trigger it or if it shows up in our app There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If your database has the user from the sample fixtures (CST User) and you log in as that user, you'll see a "Change password" link in the usertools section. ... speaking of which, that link takes us to a page that we have not overridden / that doesn't use our I'm not sure if what we should have this link or if we should override it to use our extra styles. I'll create a separate ticket for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the link shows up based on if the user "has a usable password": There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #2384 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wait, It's a link on the login page. I guess we wouldn't show it because we don't have a https://github.com/search?q=repo%3Adjango%2Fdjango%20password-reset-link&type=code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://docs.djangoproject.com/en/5.1/ref/contrib/admin/#adding-a-password-reset-feature I don't think we should worry about adding this now since we ideally want to use SSO long-term There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the other hand, any kind of self-service we can offer to users while we have to manage them locally would be handy. Let's create another ticket to figure out what to do about the Reset link on the login page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #2386 for the reset password link feature |
||
|
||
.login .clear { | ||
display: none; | ||
} | ||
|
||
/* Login Page: Google SSO Button */ | ||
.login .login-btn-area { | ||
width: 100%; | ||
} | ||
|
||
.login .google-login-btn { | ||
border: 1px solid var(--bs-primary); | ||
background-color: var(--white); | ||
height: 100%; | ||
border-radius: 4px; | ||
padding: 0; | ||
} | ||
|
||
.login .google-login-btn .btn-content { | ||
padding: 13.5px 0; | ||
border-radius: 4px; | ||
} | ||
|
||
.login .google-btn-logo { | ||
padding-right: 20px; | ||
background-color: transparent; | ||
} | ||
|
||
.login .google-login-btn:hover { | ||
color: var(--white); | ||
background-color: var(--bs-primary); | ||
} | ||
|
||
.login .google-login-btn:hover .google-btn-label, | ||
.login .google-login-btn:hover a { | ||
color: var(--bs-white); | ||
} | ||
|
||
.login .google-btn-label { | ||
color: var(--bs-primary); | ||
width: auto; | ||
font-weight: var(--medium-font-weight); | ||
font-size: var(--font-size-20px); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
{% extends "admin/base.html" %} | ||
{% load i18n static %} | ||
|
||
{% block dark-mode-vars %} | ||
{% endblock dark-mode-vars %} | ||
|
||
{% block extrastyle %} | ||
<link href="{% static "css/admin/styles.css" %}" rel="stylesheet"> | ||
<link href="{% static "img/favicon.ico" %}" rel="icon" type="image/x-icon" /> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" | ||
crossorigin="anonymous"> | ||
<script nonce="{{ request.csp_nonce }}" | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js" | ||
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" | ||
crossorigin="anonymous"></script> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" | ||
crossorigin="anonymous"> | ||
<link href="{% static "css/admin/styles.css" %}" rel="stylesheet"> | ||
{% endblock extrastyle %} | ||
|
||
{% block title %} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends "admin/login.html" %} | ||
{% load i18n static %} | ||
|
||
{% block dark-mode-vars %} | ||
{% endblock dark-mode-vars %} | ||
Comment on lines
+4
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This removes the dark mode CSS styles, effectively disabling dark mode on Admin. cc @thekaveman @angela-tran @lalver1 Right now, the Bootstrap body class declarations are overriding Django's, and we can't really change that. The extrastyle block comes after the style files from Django, and CSS reads the last file's overrides. So the dark mode looks messed up - the text is all dark (as set by Bootstrap). If we could easily set Django's CSS files to be declared last and Bootstrap's first, then we could implement dark mode. But for now it's kinda complex so I think we should just soft launch this site w/o dark mode. |
||
|
||
{% block title %} | ||
Log in | Cal-ITP Benefits Administrator | ||
{% endblock title %} | ||
Comment on lines
+7
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hardcoded the title here, instead of setting variables for |
||
|
||
{% block extrastyle %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a comment here to say why we're not bringing in jQuery here / why we're using our own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! Added here: 27bbf27 |
||
{% comment %} Overriding instead of extending agency-base here to remove jQuery declaration, which admin/login.html includes on its own {% endcomment %} | ||
<link href="{% static "img/favicon.ico" %}" rel="icon" type="image/x-icon" /> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" | ||
crossorigin="anonymous"> | ||
<link href="{% static "css/admin/styles.css" %}" rel="stylesheet"> | ||
{% endblock extrastyle %} | ||
|
||
{% block branding %} | ||
<div class="d-flex justify-content-center w-100 bg-primary"> | ||
<img class="my-3" src="{% static "img/logo-lg.svg" %}" width="220" height="50" alt="California Integrated Travel Project: Benefits logo (large)" /> | ||
</div> | ||
|
||
<div id="site-name"> | ||
<h1 class="text-center text-white fs-3 py-3 m-0">Administrator</h1> | ||
</div> | ||
{% endblock branding %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds Benefits-style focus styles to all buttons and inputs