summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-08-13 07:22:35 +0200
committerByron Jones <glob@mozilla.com>2015-08-13 07:22:35 +0200
commit6f148395ae6e5a5b56ea6cd2393e269fb90855e0 (patch)
tree57970076221d446e6aa2eec6f4247cec11e19604
parentd4a86e6b292aca70aacc49248884c64235dfa9a5 (diff)
downloadbugzilla-6f148395ae6e5a5b56ea6cd2393e269fb90855e0.tar.gz
bugzilla-6f148395ae6e5a5b56ea6cd2393e269fb90855e0.tar.xz
Bug 1192688 - non-schema changes
-rw-r--r--Bugzilla/User/APIKey.pm7
-rw-r--r--template/en/default/account/prefs/apikey.html.tmpl4
2 files changed, 8 insertions, 3 deletions
diff --git a/Bugzilla/User/APIKey.pm b/Bugzilla/User/APIKey.pm
index c37cccb92..d89203e68 100644
--- a/Bugzilla/User/APIKey.pm
+++ b/Bugzilla/User/APIKey.pm
@@ -13,7 +13,7 @@ use strict;
use parent qw(Bugzilla::Object);
use Bugzilla::User;
-use Bugzilla::Util qw(generate_random_password trim);
+use Bugzilla::Util qw(generate_random_password trim remote_ip);
use Bugzilla::Error;
#####################################################################
@@ -29,9 +29,10 @@ use constant DB_COLUMNS => qw(
description
revoked
last_used
+ last_used_ip
);
-use constant UPDATE_COLUMNS => qw(description revoked last_used);
+use constant UPDATE_COLUMNS => qw(description revoked last_used last_used_ip);
use constant VALIDATORS => {
api_key => \&_check_api_key,
app_id => \&_check_app_id,
@@ -55,6 +56,7 @@ sub app_id { return $_[0]->{app_id} }
sub description { return $_[0]->{description} }
sub revoked { return $_[0]->{revoked} }
sub last_used { return $_[0]->{last_used} }
+sub last_used_ip { return $_[0]->{last_used_ip} }
# Helpers
sub user {
@@ -68,6 +70,7 @@ sub update_last_used {
my $timestamp = shift
|| Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
$self->set('last_used', $timestamp);
+ $self->set('last_used_ip', remote_ip());
$self->update;
}
diff --git a/template/en/default/account/prefs/apikey.html.tmpl b/template/en/default/account/prefs/apikey.html.tmpl
index ff9ed697a..8b740cf1e 100644
--- a/template/en/default/account/prefs/apikey.html.tmpl
+++ b/template/en/default/account/prefs/apikey.html.tmpl
@@ -41,7 +41,9 @@ here.</p>
value="[% api_key.description FILTER html %]">
</td>
[% IF api_key.last_used %]
- <td>[% api_key.last_used FILTER time %]</td>
+ <td>[% api_key.last_used FILTER time %]
+ [% IF api_key.last_used_ip %] ([% api_key.last_used_ip FILTER html %]) [% END %]
+ </td>
[% ELSE %]
<td class="center"><i>never used</i></td>
[% END %]