configure_2fa.mako
90 lines
| 2.9 KiB
| application/x-mako
|
MakoHtmlLexer
r5360 | <%inherit file="base/root.mako"/> | |||
<%def name="title()"> | ||||
r5367 | ${_('Setup 2FA')} | |||
r5360 | %if c.rhodecode_name: | |||
· ${h.branding(c.rhodecode_name)} | ||||
%endif | ||||
</%def> | ||||
r5373 | ||||
r5360 | <style>body{background-color:#eeeeee;}</style> | |||
r5373 | <div class="loginbox" style="width: 600px"> | |||
r5360 | <div class="header-account"> | |||
<div id="header-inner" class="title"> | ||||
<div id="logo"> | ||||
% if c.rhodecode_name: | ||||
<div class="branding"> | ||||
<a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a> | ||||
</div> | ||||
% endif | ||||
</div> | ||||
</div> | ||||
</div> | ||||
<div class="loginwrapper"> | ||||
<rhodecode-toast id="notifications"></rhodecode-toast> | ||||
r5373 | <div class="sign-in-title"> | |||
<h1>${_('Set up the authenticator app')} - ${_('scan the QR code')}</h1> | ||||
</div> | ||||
<div class="inner form"> | ||||
r5367 | ${h.secure_form(h.route_path('setup_2fa'), request=request, id='totp_form')} | |||
r5373 | <strong>${_('Use an authenticator app to scan.')}</strong><br/> | |||
## QR CODE | ||||
<code>${_('Account')}: ${totp_name}</code><br/> | ||||
<div class="qr-code-container"> | ||||
<img alt="qr-code" src="data:image/png;base64, ${qr}"/> | ||||
r5360 | </div> | |||
r5373 | ||||
<div id="alternativeCode" style="margin: -10px 0 5px 0">${_('Unable to scan?')} <a id="toggleLink">${_('Click here')}</a></div> | ||||
## Secret alternative code | ||||
<div id="secretDiv" style="display: none"> | ||||
r5367 | ||||
r5373 | <div style="padding: 10px 0"> | |||
<strong style="padding: 4px 0">${_('Copy and use this code to manually set up an authenticator app')}</strong> | ||||
<code>${key}</code><i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${key}" title="${_('Copy the secret key')}" ></i><br/> | ||||
<code>${_('type')}: time-based</code> | ||||
</div> | ||||
r5360 | </div> | |||
r5367 | ||||
r5373 | <label for="totp">${_('Verify the code from the app')}:</label> | |||
${h.text('totp', class_='form-control', )} | ||||
<div id="formErrors"> | ||||
% if 'totp' in errors: | ||||
<span class="error-message">${errors.get('totp')}</span> | ||||
<br /> | ||||
% endif | ||||
% if 'secret_totp' in errors: | ||||
<span class="error-message">SECRET:${errors.get('secret_totp')}</span> | ||||
<br /> | ||||
% endif | ||||
</div> | ||||
${h.hidden('secret_totp', key)} | ||||
${h.submit('verify_2fa',_('Verify'), class_="btn sign-in")} | ||||
r5367 | ||||
${h.end_form()} | ||||
r5360 | </div> | |||
r5373 | ||||
r5360 | </div> | |||
r5373 | ||||
r5360 | </div> | |||
r5373 | <script type="text/javascript"> | |||
$(document).ready(function() { | ||||
r5360 | ||||
r5373 | $( "#toggleLink" ).on("click", function() { | |||
$( "#secretDiv" ).toggle(); | ||||
$( "#alternativeCode").hide(); | ||||
$('#totp').focus(); | ||||
}); | ||||
$('#totp').focus(); | ||||
}) | ||||
r5360 | ||||
</script> | ||||