diff options
author | Dimitrie Hoekstra <dimitriehoekstra@gmail.com> | 2018-06-25 17:35:31 +0200 |
---|---|---|
committer | Dimitrie Hoekstra <dimitriehoekstra@gmail.com> | 2018-06-25 17:35:31 +0200 |
commit | 7f0e6397148ccd3ce9d3f633b90a3d45b0ee1b72 (patch) | |
tree | 0702805ca106ada96c36b990f72a8eaff4ea0bee | |
parent | 203be787486dc10ae2e007d19ae5c4055de49831 (diff) | |
download | gitlab-ce-add-2fa-button.tar.gz |
Added button to download 2FA codesadd-2fa-button
-rw-r--r-- | app/views/profiles/two_factor_auths/_codes.html.haml | 13 | ||||
-rw-r--r-- | changelogs/unreleased/add-2fa-button.yml | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/app/views/profiles/two_factor_auths/_codes.html.haml b/app/views/profiles/two_factor_auths/_codes.html.haml index 93722d7b034..aab45d9fb4b 100644 --- a/app/views/profiles/two_factor_auths/_codes.html.haml +++ b/app/views/profiles/two_factor_auths/_codes.html.haml @@ -10,4 +10,17 @@ %li %span.monospace= code +:javascript + function download(text) { + var element = document.createElement('a'); + element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); + element.setAttribute('download', 'gitlab-recovery-codes.txt'); + + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + document.body.removeChild(element); + } + +%button{:class => 'btn', :onclick => "download('#{@codes.join('\n')}')"} Download Codes = link_to 'Proceed', profile_account_path, class: 'btn btn-success' diff --git a/changelogs/unreleased/add-2fa-button.yml b/changelogs/unreleased/add-2fa-button.yml new file mode 100644 index 00000000000..6cb71d52781 --- /dev/null +++ b/changelogs/unreleased/add-2fa-button.yml @@ -0,0 +1,5 @@ +--- +title: Add button to download 2FA codes +merge_request: +author: Luke Picciau +type: added |