Admin users in red, at beginning, in dev login view

(imported from commit 530f0a5d26d5c2b637834281e45adb399852ae0a)
This commit is contained in:
David Roe 2015-08-18 20:35:29 -07:00 committed by Tim Abbott
parent 902edf5200
commit 32783ebbfb
3 changed files with 18 additions and 5 deletions

View File

@ -776,12 +776,20 @@ a.bottom-signup-button {
margin-top: 0px;
margin-bottom: 0px;
padding: 8px;
color: #fff;
font-size: 18px;
background-color: #428bca;
border-color: #357ebd;
border-radius: 5px;
min-width: 300px;
color: #fff;
}
.btn-user {
background-color: #428bca;
border-color: #357ebd;
}
.btn-admin {
background-color: #ff4136;
border-color: #bd7e35;
}
.feature-page-header {

View File

@ -107,8 +107,11 @@ autofocus('#id_username');
<label for="direct_email" class="direct-label">or Choose a user:</label>
{% endif %}
<div class="controls">
{% for user_email in direct_admins %}
<p><input type="submit" name="direct_email" class="btn-direct btn-admin" value="{{ user_email }}" /></p>
{% endfor %}
{% for user_email in direct_users %}
<p><input type="submit" name="direct_email" class="btn-direct" value="{{ user_email }}" /></p>
<p><input type="submit" name="direct_email" class="btn-direct btn-user" value="{{ user_email }}" /></p>
{% endfor %}
</div>
</div>

View File

@ -788,7 +788,9 @@ def finish_google_oauth2(request):
def login_page(request, **kwargs):
extra_context = kwargs.pop('extra_context',{})
if dev_auth_enabled():
extra_context['direct_users'] = sorted([u.email for u in UserProfile.objects.filter(is_bot=False, is_active=True)])
users = UserProfile.objects.filter(is_bot=False, is_active=True)
extra_context['direct_admins'] = sorted([u.email for u in users if u.is_admin()])
extra_context['direct_users'] = sorted([u.email for u in users if not u.is_admin()])
template_response = django_login_page(
request, authentication_form=OurAuthenticationForm,
extra_context=extra_context, **kwargs)