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

Download this file

111 lines (101 with data), 4.2 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
{#-
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}} / Multifactor Authentication Setup{% endblock %}
{% block header %}Multifactor Authentication Setup for {{c.user.username}}{% endblock %}
{% block content %}
{{ super() }}
<div class='grid-20'>
{% if setup %}
{% if c.user.get_pref('multifactor') %}
<h3>Warning: this will invalidate your previous multifactor configuration.</h3>
{% endif %}
<h2>Install App</h2>
<form action="totp_send_link" id="totp_send_link" method="post">
<p>To use two-factor authentication, you will need to install an app on your phone.<br>
Install Google Authenticator for
<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2"><b>Android</b></a>
or <a href="https://itunes.apple.com/us/app/google-authenticator/id388497605"><b>iOS</b></a>.
<a href="#" class="ajax-submit-form">Email me these links.</a>
<br>
Or use another app like Duo Mobile, Authy, or Authenticator for Windows phones.
</p>
{{ lib.csrf_token() }}
</form>
{% endif %}
<h2>Scan this barcode with your app</h2>
<img class="qrcode" src="{{ h.base64uri(qr) }}"/>
{% if setup %}
<h2>Enter the code</h2>
<form method="POST" action="totp_set" id="totp_set">
<p>
Enter the {{ config['auth.multifactor.totp.length'] }}-digit code to confirm it is set up correctly:<br>
{% if c.form_errors['code'] %}
<span class="fielderror">{{ c.form_errors['code'] }}</span><br>
{% endif %}
<input type="text" name="code" autofocus autocomplete="off"/>
{{ lib.csrf_token() }}
<br>
<input type="submit" value="Submit">
<a class="cancel" href="/auth/preferences/">Cancel</a>
</p>
</form>
{% else %}
<p>
You may use this to set up additional devices with the same two-factor key.<br>
<br>
If you are replacing a device, please <a href="totp_new">regenerate a brand new key</a>.<br>
<br>
<a href="/auth/preferences/">Back</a>
</p>
{% endif %}
</div>
{% endblock %}
{% block extra_css %}
<style type="text/css">
.qrcode {
/* compensate for whitespace on QR code image */
position: relative;
top: -15px;
margin-bottom: -15px;
}
a.cancel {
/* align with floated button */
display: inline-block;
margin: 6px 10px;
}
</style>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
$(function() {
$('a.ajax-submit-form').click(function(e){
e.preventDefault();
$form = $(this).closest('form');
$.post($form.attr('action'), $form.serialize())
.done(function() {
$('#messages').notify({message: 'Email sent!'});
})
.fail(function() {
$('#messages').notify({message: 'Error sending email', status: 'error'});
});
});
});
</script>
{% endblock %}