Record successful 2FA authentication in session cookie
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -26,7 +26,9 @@
|
||||
<tbody>
|
||||
{% for f in user.two_factor %}
|
||||
<tr id="factor-{{ f.id.0 }}">
|
||||
<td><img src="{{ f.type_image() }}" alt="Factor icon" style="height: 1.5em; margin-right: 0.5em;" />{{ f.type_str() }}</td>
|
||||
<td><img src="{{ f.type_image() }}" alt="Factor icon" style="height: 1.5em; margin-right: 0.5em;"/>{{
|
||||
f.type_str() }}
|
||||
</td>
|
||||
<td>{{ f.name }}</td>
|
||||
<td><a href="javascript:delete_factor('{{ f.id.0 }}');">Delete</a></td>
|
||||
</tr>
|
||||
@ -53,7 +55,9 @@
|
||||
{% for e in user.get_formatted_2fa_successful_logins() %}
|
||||
<tr>
|
||||
<td>{{ e.ip }}</td>
|
||||
<td><locateip ip="{{ e.ip }}"></locateip></td>
|
||||
<td>
|
||||
<locateip ip="{{ e.ip }}"></locateip>
|
||||
</td>
|
||||
<td>{{ e.fmt_time() }}</td>
|
||||
<td>{% if e.can_bypass_2fa %}YES{% else %}NO{% endif %}</td>
|
||||
</tr>
|
||||
@ -63,6 +67,10 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if let Some(last_2fa_auth) = last_2fa_auth %}
|
||||
<p>Last successful 2FA authentication on this browser: {{ last_2fa_auth }}</p>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
async function delete_factor(id) {
|
||||
if (!confirm("Do you really want to remove this factor?"))
|
||||
@ -72,7 +80,7 @@
|
||||
const res = await fetch("/settings/api/two_factor/delete_factor", {
|
||||
method: "post",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
id: id,
|
||||
@ -84,7 +92,7 @@
|
||||
|
||||
if (res.status == 200)
|
||||
document.getElementById("factor-" + id).remove();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert("Failed to remove factor!");
|
||||
}
|
||||
@ -104,7 +112,7 @@
|
||||
|
||||
if (res.status == 200)
|
||||
document.getElementById("2fa_history_container").remove();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert("Failed to clear 2FA history!");
|
||||
}
|
||||
|
Reference in New Issue
Block a user