From c8447e9f4b7c17ab0e04af34dbd5583e78b23677 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 29 Jan 2015 17:33:12 +0000 Subject: Bug 1045145: backport upstream bug 726696 to bmo/4.2 to allow use of api keys for authentication --- template/en/default/account/prefs/apikey.html.tmpl | 86 ++++++++++++++++++++++ template/en/default/account/prefs/prefs.html.tmpl | 5 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 template/en/default/account/prefs/apikey.html.tmpl (limited to 'template/en/default/account/prefs') diff --git a/template/en/default/account/prefs/apikey.html.tmpl b/template/en/default/account/prefs/apikey.html.tmpl new file mode 100644 index 000000000..ff9ed697a --- /dev/null +++ b/template/en/default/account/prefs/apikey.html.tmpl @@ -0,0 +1,86 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[%# INTERFACE: + # api_keys: array. Array of api keys this user has. + # any_revoked: boolean. True is any keys have been revoked. + #%] + +

+ API keys are used to authenticate WebService API calls. You can create more than + one API key if required. Each API key has an optional description which can help + you record what each key is used for. Documentation on how to log in is available from + + here. +

+ +

Existing API keys

+ +

You can update the description, and revoke or unrevoke existing API keys +here.

+ + + + + + + + + + [% FOREACH api_key IN api_keys %] + + + + [% IF api_key.last_used %] + + [% ELSE %] + + [% END %] + + + [% END %] + [% UNLESS api_keys.size %] + + [% END %] +
API keyDescription (optional)Last usedRevoked
[% api_key.api_key FILTER html %] + + [% api_key.last_used FILTER time %]never used + +
You don't have any API keys.
+ +[% IF any_revoked %] + Hide Revoked Keys + [%# Show the link if the browser supports JS %] + +[% END %] + +

New API key

+ +

You can generate a new API key by ticking the check box below and optionally +providing a description for the API key. The API key will be randomly +generated for you.

+ +

+ + + +

+ diff --git a/template/en/default/account/prefs/prefs.html.tmpl b/template/en/default/account/prefs/prefs.html.tmpl index 2e8b561de..65649b814 100644 --- a/template/en/default/account/prefs/prefs.html.tmpl +++ b/template/en/default/account/prefs/prefs.html.tmpl @@ -40,7 +40,7 @@ title = "User Preferences" subheader = filtered_login style_urls = ['skins/standard/admin.css'] - javascript_urls = ['js/util.js', 'js/field.js'] + javascript_urls = ['js/util.js', 'js/field.js', 'js/TUI.js'] doc_section = "userpreferences.html" yui = ['autocomplete'] %] @@ -53,6 +53,9 @@ link => "userprefs.cgi?tab=saved-searches", saveable => "1" }, { name => "account", label => "Account Information", link => "userprefs.cgi?tab=account", saveable => "1" }, + { name => "apikey", label => "API Keys", + link => "userprefs.cgi?tab=apikey", saveable => "1", + doc_section => "using.html#apikey" }, { name => "permissions", label => "Permissions", link => "userprefs.cgi?tab=permissions", saveable => "0" } ] %] -- cgit v1.2.3-24-g4f1b