Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #4494 from gratipay/friendlier-401
Browse files Browse the repository at this point in the history
Make the 401 page friendlier
  • Loading branch information
rohitpaulk authored Jun 2, 2017
2 parents a329101 + e9f42f6 commit 6906147
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 40 deletions.
9 changes: 6 additions & 3 deletions 401.spt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from aspen.http import status_strings
[---]
banner = "401"
banner = _("Sign In")
suppress_sidebar = True
[---] text/html via jinja2
{% extends "templates/base.html" %}
{% block content %}
<p>{{ _('Please sign in to continue.') }}</p>
<p>{{ sign_in_using() }}</p>
<p class="description important-thing-at-the-top">{{ _('Please sign in to continue.') }}</p>
<div class="important-button">
{{ sign_in_using(button_class='large') }}
</div>
{% endblock %}
[---] application/json via stdlib_percent
{ "error_code": 401
Expand Down
9 changes: 9 additions & 0 deletions scss/components/text-treatments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
#content {
.important-thing-at-the-top {
margin: 20px 0 60px;
text-align: center;
&.description {
font: normal 18pt/24pt $Chronicle;
&.long {
font: normal 11pt/15pt $Chronicle;
}
padding: 0 17%;
}
}

.sorry {
text-align: center;
font: normal 12px/15px $Ideal;
Expand Down
28 changes: 28 additions & 0 deletions scss/elements/buttons-knobs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,31 @@ button.selected:hover:not(:disabled), button.selected.drag,
top: 0;
right: 0;
}


.important-button {
margin: 38px auto 30px;
text-align: center;

button.large {
font: normal 16px/32px $Ideal;
padding: 10px 16px;
border-radius: 5px;

.caret {
border-top: 8px solid #fff;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
margin-top: 13px;
}
}
.dropdown-menu {
/* override components/sign_in */
border-radius: 0 0 3px 3px ! important;
top: 50px ! important;
width: 90%;
left: 5%;
}
}


32 changes: 0 additions & 32 deletions scss/pages/package.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
margin: 0 0 30px;
font-family: $Ideal;
}
.description {
font: normal 18pt/24pt $Chronicle;
&.long {
font: normal 11pt/15pt $Chronicle;
}
padding: 0 17%;
}

.selected .icon { display: block; }
.icon {
Expand All @@ -36,29 +29,4 @@
ul:not(.open) .status-icon {
color: $medium-gray;
}

.button-wrapper {
margin: 38px auto 30px;

button.large {
font: normal 16px/32px $Ideal;
padding: 10px 16px;
border-radius: 5px;

.caret {
border-top: 8px solid #fff;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
margin-top: 13px;
}
}
.dropdown-menu {
top: 50px;
width: 90%;
left: 5%;
border-radius: 0 0 3px 3px;
}
}


}
4 changes: 2 additions & 2 deletions tests/py/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ def test_braintree_linked_from_credit_card_page(self, foo, bar):
body = self.client.GET("/~alice/routes/credit-card.html", auth_as="alice").body
assert "Braintree" in body

def test_dashboard_is_403_for_anon(self):
def test_dashboard_is_401_for_anon(self):
self.make_participant('admin', is_admin=True)
assert self.client.GxT('/dashboard/').code == 403
assert self.client.GxT('/dashboard/').code == 401

def test_dashboard_is_403_for_non_admin(self):
self.make_participant('alice')
Expand Down
2 changes: 1 addition & 1 deletion www/dashboard/index.spt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from aspen import Response

[---]
if not user.ADMIN:
raise Response(403)
raise Response(401 if user.ANON else 403)


unreviewed = website.db.all("""
Expand Down
4 changes: 2 additions & 2 deletions www/on/npm/%package/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if user.participant:
</p>

{% if user.ANON %}
<div class="button-wrapper">
<div class="important-button">
{{ sign_in_using(button_class='large') }}
</div>
{% else %}
Expand Down Expand Up @@ -108,7 +108,7 @@ if user.participant:
</ul>
</div>

<div class="button-wrapper">
<div class="important-button">
<button type="submit" class="apply selected large"
{% if not has_email_options %} disabled{% endif %}>
{{ _('Apply to accept payments') }}
Expand Down

0 comments on commit 6906147

Please sign in to comment.