configure_2fa.mako
87 lines
| 3.5 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> | ||||
<style>body{background-color:#eeeeee;}</style> | ||||
<div class="loginbox"> | ||||
<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"> | ||||
r5367 | <h1>${_('Setup the authenticator app')}</h1> | |||
r5360 | <p>Authenticator apps like <a href='https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2' target="_blank" rel="noopener noreferrer">Google Authenticator</a>, etc. generate one-time passwords that are used as a second factor to verify you identity.</p> | |||
<rhodecode-toast id="notifications"></rhodecode-toast> | ||||
<div id="setup_2fa"> | ||||
r5367 | ${h.secure_form(h.route_path('setup_2fa'), request=request, id='totp_form')} | |||
r5360 | <div class="sign-in-title"> | |||
r5367 | <h1>${_('Scan the QR code')}: "${totp_name}"</h1> | |||
r5360 | </div> | |||
r5367 | <p>${_('Use an authenticator app to scan.')}</p> | |||
<img alt="qr-code" src="data:image/png;base64, ${qr}"/> | ||||
r5360 | <p>${_('Unable to scan?')} <a id="toggleLink">${_('Click here')}</a></p> | |||
<div id="secretDiv" class="hidden"> | ||||
r5367 | <p>${_('Copy and use this code to manually set up an authenticator app')}</p> | |||
<input type="text" class="input-monospace" value="${key}" id="secret_totp" name="secret_totp" style="width: 400px"/> | ||||
<i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${key}" title="${_('Copy the secret key')}"></i> | ||||
r5360 | </div> | |||
r5367 | ||||
r5360 | <div id="verify_2fa"> | |||
r5367 | ||||
r5360 | <div class="form mt-4"> | |||
<div class="field"> | ||||
<p> | ||||
<div class="label"> | ||||
<label for="totp" class="form-label text-dark font-weight-bold" style="text-align: left;">${_('Verify the code from the app')}:</label> | ||||
</div> | ||||
</p> | ||||
<p> | ||||
<div> | ||||
<div class="input-group"> | ||||
${h.text('totp', class_='form-control', style='width: 40%;')} | ||||
<div id="formErrors"> | ||||
r5367 | % if 'totp' in errors: | |||
r5360 | <span class="error-message">${errors.get('totp')}</span> | |||
<br /> | ||||
r5367 | % endif | |||
r5360 | </div> | |||
<div class="input-group-append"> | ||||
r5367 | ${h.submit('verify_2fa',_('Verify'),class_="btn btn-primary", style='width: 40%;')} | |||
r5360 | </div> | |||
</div> | ||||
</div> | ||||
</p> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
r5367 | ${h.end_form()} | |||
r5360 | </div> | |||
</div> | ||||
</div> | ||||
<script> | ||||
r5367 | document.getElementById('toggleLink').addEventListener('click', function() { | |||
let hiddenField = document.getElementById('secretDiv'); | ||||
if (hiddenField.classList.contains('hidden')) { | ||||
hiddenField.classList.remove('hidden'); | ||||
} | ||||
}); | ||||
r5360 | ||||
</script> | ||||