[9fbddb]: / Allura / allura / templates / user_recovery_codes.html  Maximize  Restore  History

Download this file

116 lines (105 with data), 3.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% set hide_left_bar = True %}
{% set current_menu_item = '/auth/preferences' %}
{% extends "allura:templates/user_account_base.html" %}
{% block title %}{{c.user.username}} / Recovery Codes for Multifactor Authentication{% endblock %}
{% block header %}Recovery Codes for Multifactor Authentication{% endblock %}
{% macro plaintext(codes) %}
{{- config['site_name'] }} Recovery Codes:
{% for code in codes %}
{{ code -}}
{% endfor %}
{% endmacro %}
{% block content %}
{{ super() }}
<div class='grid-20'>
<h2 class="subtitle">Your {{ config['site_name'] }} Recovery Codes</h2>
<p>
<a href="#" class="print"><strong>Print</strong></a> these!
<a href="{{ h.base64uri(plaintext(codes), mimetype='text/plain', windows_line_endings=windows_line_endings) }}" download="{{ config['site_name'] }} recovery codes.txt" class="download"><strong>Download</strong></a> them!
Keep them safe.
</p>
<p>
It is essential to keep a copy of these recovery codes, otherwise you may get permanently locked out of your account, if you lose
your authenticator device.
</p>
<p>
<a href="/auth/preferences/">Back to Account Settings</a>
</p>
<hr>
<p class="codes">
{% for code in codes %}
{{ code }}<br>
{% endfor %}
</p>
<hr>
<form action="multifactor_recovery_regen" id="multifactor_recovery_regen" method="post">
<p>
If you regenerate your recovery codes, your old ones will not work any more.
You will need to save the new ones.
</p>
<p>
<input type="submit" value="Regenerate Codes">
</p>
{{ lib.csrf_token() }}
</form>
</div>
{% endblock %}
{% block extra_css %}
<style type="text/css">
p.codes {
-moz-columns: 2;
columns: 2;
font-size: 300%;
line-height: 125%;
padding-bottom: 0;
}
@media print {
/* don't show link destinations */
a:after {
content: '';
}
}
</style>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
$(function() {
$('#multifactor_recovery_regen').submit(function(e) {
var ok = confirm('Are you sure you want to regenerate your recovery codes?');
if(!ok) {
e.preventDefault();
}
});
$('.print').click(function(e) {
window.print();
});
if (window.navigator.msSaveBlob) {
// IE doesn't support base64 links or the download attr, so use its msSaveBlob
$('.download').click(function(e) {
e.preventDefault();
var fileData = $('.subtitle').text() + '\n\n' + $('.codes').text();
fileData = fileData.replace(new RegExp('\n', 'g'), '\r\n');
blobObject = new Blob([fileData]);
var fileName = $('.download').attr('download');
window.navigator.msSaveBlob(blobObject, fileName);
});
}
});
</script>
{% endblock %}