diff options
Diffstat (limited to 'extensions/BrowserID/template/en/default/hook/account')
3 files changed, 124 insertions, 0 deletions
diff --git a/extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl b/extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl new file mode 100644 index 000000000..2b6f4b85a --- /dev/null +++ b/extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl @@ -0,0 +1,57 @@ +[% IF Param('user_info_class').split(',').contains('BrowserID') %] + +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +<script src="https://browserid.org/include.js" type="text/javascript"></script> + +<script type="text/javascript"> +function browserid_sign_in() { + navigator.id.getVerifiedEmail(function(assertion) { + if (assertion) { + // This code will be invoked once the user has successfully + // selected an email address they control to sign in with. + var browseridForm = document.createElement('form'); + browseridForm.action = '[% target FILTER js %]'; + browseridForm.method = 'POST'; + browseridForm.style.display = 'none'; + + var tokenField = document.createElement('input'); + tokenField.type = 'hidden'; + tokenField.name = 'token'; + tokenField.value = '[% issue_hash_token(['login']) FILTER js %]'; + browseridForm.appendChild(tokenField); + + var assertionField = document.createElement('input'); + assertionField.type = 'hidden'; + assertionField.name = 'browserid_assertion'; + assertionField.value = assertion; + browseridForm.appendChild(assertionField); + + var hidden_fields =[]; + var field_count = 0; + [% FOREACH field = cgi.param() %] + [% NEXT IF field.search("^(Bugzilla_(login|password|restrictlogin)|token|browserid_assertion)$") %] + [% FOREACH mvalue = cgi.param(field).slice(0) %] + hidden_fields[field_count] = document.createElement('input'); + hidden_fields[field_count].type = 'hidden'; + hidden_fields[field_count].name = '[% field FILTER js %]'; + hidden_fields[field_count].value = '[% mvalue FILTER html_linebreak FILTER js %]'; + browseridForm.appendChild(hidden_fields[field_count]); + [% END %] + field_count++; + [% END %] + + document.body.appendChild(browseridForm); + browseridForm.submit(); + return true; + } + }); +} +</script> + +<p> +Or, log in with BrowserID: +<img src="extensions/BrowserID/web/sign_in_orange.png" onclick="browserid_sign_in()"> +</p> +[% END %] diff --git a/extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl b/extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl new file mode 100644 index 000000000..26d5ff609 --- /dev/null +++ b/extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl @@ -0,0 +1,36 @@ +[% IF Param('user_info_class').split(',').contains('BrowserID') %] +<script src="https://browserid.org/include.js" type="text/javascript"></script> + +<script type="text/javascript"> +function browserid_sign_in() { + navigator.id.getVerifiedEmail(function(assertion) { + if (assertion) { + // This code will be invoked once the user has successfully + // selected an email address they control to sign in with. + var browseridForm = document.createElement('form'); + browseridForm.action = '[% login_target FILTER js %]'; + browseridForm.method = 'POST'; + browseridForm.style.display = 'none'; + + var tokenField = document.createElement('input'); + tokenField.type = 'hidden'; + tokenField.name = 'token'; + tokenField.value = '[% issue_hash_token(['login']) FILTER js %]'; + browseridForm.appendChild(tokenField); + + var assertionField = document.createElement('input'); + assertionField.type = 'hidden'; + assertionField.name = 'browserid_assertion'; + assertionField.value = assertion; + browseridForm.appendChild(assertionField); + + document.body.appendChild(browseridForm); + browseridForm.submit(); + return true; + } + }); +} +</script> + +<img src="extensions/BrowserID/web/sign_in_orange.png" onclick="browserid_sign_in()" style="margin-bottom: -8px"> or +[% END %] diff --git a/extensions/BrowserID/template/en/default/hook/account/create-additional_methods.html.tmpl b/extensions/BrowserID/template/en/default/hook/account/create-additional_methods.html.tmpl new file mode 100644 index 000000000..6f75f5cd7 --- /dev/null +++ b/extensions/BrowserID/template/en/default/hook/account/create-additional_methods.html.tmpl @@ -0,0 +1,31 @@ +[%# 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 Param('user_info_class').split(',').contains('BrowserID') %] +<script type="text/javascript"> +function browserid_create_account() { + navigator.id.getVerifiedEmail(function(assertion) { + if (assertion) { + // This code will be invoked once the user has successfully + // selected an email address they control to sign in with. + document.getElementById('browserid_assertion').value = assertion; + document.getElementById('browserid_form').submit(); + return true; + } + }); +} +</script> + +Or, use your BrowserID account: +<img src="extensions/BrowserID/web/sign_in_orange.png" onclick="browserid_create_account()"> + +<form id="browserid_form" method="POST" action="index.cgi"> + <input type="hidden" name="token" value="[% issue_hash_token(['login']) FILTER html %]"> + <input type="hidden" name="browserid_assertion" id="browserid_assertion" value=""> +</form> +[% END %] |