From 421ff7f194875db9634ea783d9dd5b6111f19df3 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 1 Sep 2015 13:01:20 +0800 Subject: Bug 1197073 - add support for 2fa using totp (eg. google authenticator) --- template/en/default/account/cancel-token.txt.tmpl | 3 + template/en/default/account/prefs/mfa.html.tmpl | 134 ++++++++++++++++++++++ template/en/default/account/prefs/prefs.html.tmpl | 7 ++ 3 files changed, 144 insertions(+) create mode 100644 template/en/default/account/prefs/mfa.html.tmpl (limited to 'template/en/default/account') diff --git a/template/en/default/account/cancel-token.txt.tmpl b/template/en/default/account/cancel-token.txt.tmpl index 6619dedd3..bc35e2d4c 100644 --- a/template/en/default/account/cancel-token.txt.tmpl +++ b/template/en/default/account/cancel-token.txt.tmpl @@ -93,6 +93,9 @@ Canceled Because: [% PROCESS cancelactionmessage %] [% ELSIF cancelaction == 'wrong_token_for_creating_account' %] You have tried to use the token to create a user account. + [% ELSIF cancelaction == 'wrong_token_for_mfa' %] + You have tried to use the token for MFA. + [% ELSE %] [%# Give sensible error if the cancel-token function is used incorrectly. #%] diff --git a/template/en/default/account/prefs/mfa.html.tmpl b/template/en/default/account/prefs/mfa.html.tmpl new file mode 100644 index 000000000..750e34cee --- /dev/null +++ b/template/en/default/account/prefs/mfa.html.tmpl @@ -0,0 +1,134 @@ +[%# 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. + #%] + +[% IF NOT Bugzilla.feature('mfa') %] + +

+ Two-factor Authentication is not available. +

+ [% RETURN %] +[% END %] +[% IF user.cryptpassword == '*' %] + +

+ Two-factor Authentication is not available on your account because you are + using an external authentication provider. +

+ [% RETURN %] +[% END %] + +
+ [% IF user.mfa %] +

+ Two-factor authentication is currently enabled using + [% SWITCH user.mfa %] + [% CASE "TOTP" %]TOTP + [% END %]. +

+ + + + + + + [% ELSE %] +

+ Two-factor authentication is currently disabled. +

+ + + + + + + [% END %] + + + +
diff --git a/template/en/default/account/prefs/prefs.html.tmpl b/template/en/default/account/prefs/prefs.html.tmpl index 679a3cb30..853841bff 100644 --- a/template/en/default/account/prefs/prefs.html.tmpl +++ b/template/en/default/account/prefs/prefs.html.tmpl @@ -44,6 +44,7 @@ generate_api_token = 1 style_urls = ['skins/standard/admin.css'] javascript_urls = ['js/util.js', 'js/field.js', 'js/TUI.js', 'js/account.js'] + jquery = ['bPopup'], doc_section = "userpreferences.html"; tabs = [ @@ -71,6 +72,12 @@ link => "userprefs.cgi?tab=saved-searches", saveable => "1" }, + { + name => "mfa", + label => "Two-Factor Authentication", + link => "userprefs.cgi?tab=mfa", + saveable => "1" + }, { name => "sessions", label => "Sessions", -- cgit v1.2.3-24-g4f1b