Show authorized apps on the account activity page.

This commit is contained in:
Logan Hanks
2012-08-27 16:08:51 -07:00
parent 02f1490cb6
commit 7592e36d0f
5 changed files with 31 additions and 6 deletions

View File

@@ -3620,6 +3620,9 @@ class AccountActivityPage(BoringPage):
class UserIPHistory(Templated):
def __init__(self):
from r2.controllers.oauth2 import scope_info
self.my_apps = [(app, [scope_info[scope] for scope in scopes])
for app, scopes in OAuth2Client._by_user(c.user)]
self.ips = ips_by_account_id(c.user._id)
super(UserIPHistory, self).__init__()

View File

@@ -170,6 +170,11 @@ string_dict = dict(
unvotable_message = _("sorry, this has been archived and can no longer be voted on"),
account_activity_blurb = _("This page shows a history of recent activity on your account. If you notice unusual activity, you should change your password immediately. Location information is guessed from your computer's IP address and may be wildly wrong, especially for visits from mobile devices. Note: due to a bug, private-use addresses (starting with 10.) sometimes show up erroneously in this list after regular use of the site."),
your_current_ip_is = _("You are currently accessing reddit from this IP address: %(address)s."),
account_activity_apps_blurb = _("""
These apps are authorized to access your account. Logging out of all sessions
will revoke access from all apps. You may also revoke access from individual
apps below.
"""),
traffic_promoted_link_explanation = _("Below you will see your promotion's impression and click traffic per hour of promotion. Please note that these traffic totals will lag behind by two to three hours, and that daily totals will be preliminary until 24 hours after the link has finished its run."),
traffic_processing_slow = _("Traffic processing is currently running slow. The latest data available is from %(date)s. This page will be updated as new data becomes available."),

View File

@@ -5883,6 +5883,7 @@ tr.gold-accent + tr > td {
padding: 7px;
position: relative;
width: 880px;
font-size: x-small;
}
.developed-app.collapsed, .authorized-app { height: 100px; }
@@ -5900,8 +5901,8 @@ tr.gold-accent + tr > td {
vertical-align: top;
}
.app-details h2 { font-size: medium; }
.app-details h3 { font-size: x-small; }
.app-details h2 { font-size: medium; margin: 0px; }
.app-details h3 { font-size: x-small; margin: 0px; }
.app-icon {
display: inline-block;

View File

@@ -165,10 +165,7 @@
</li>
</%def>
%if thing.my_apps:
<h1>${_("authorized applications")}</h1>
%for app, scopes in thing.my_apps:
<%def name="authorized_app(app, scopes)">
<div id="authorized-app-${app._id}" class="authorized-app rounded">
${icon(app)}
<div class="app-details">
@@ -197,6 +194,13 @@
hidden_data=dict(client_id=app._id),
_class="revoke-app-button")}
</div>
</%def>
%if thing.my_apps:
<h1>${_("authorized applications")}</h1>
%for app, scopes in thing.my_apps:
${authorized_app(app, scopes)}
%endfor
%endif

View File

@@ -20,6 +20,7 @@
## reddit Inc. All Rights Reserved.
###############################################################################
<%namespace file="prefapps.html" import="authorized_app"/>
<%namespace file="utils.html" import="error_field, timestamp"/>
<%namespace name="utils" file="utils.html"/>
@@ -72,3 +73,14 @@
<span class="status error"></span>
</form>
%if thing.my_apps:
<hr/>
<div id="account-activity-apps" class="instructions">
<h1>${_("Apps you have authorized")}</h1>
<p>${strings.account_activity_apps_blurb}</p>
%for app, scopes in thing.my_apps:
${authorized_app(app, scopes)}
%endfor
</div>
%endif