Implemented user profile settings, OAuth apps, and maintenance windows. Other minor fixes/improvements

This commit is contained in:
2021-03-11 10:37:07 -05:00
parent a020009c47
commit c58e2fc545
48 changed files with 3152 additions and 36 deletions

View File

@ -0,0 +1,98 @@
<!--
This file is part of Linode Manager Classic.
Linode Manager Classic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Linode Manager Classic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LMC - Two-Factor Authentication</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="twofactor.css" />
<script src="twofactor.js" type="module"></script>
</head>
<body>
<!--#include virtual="/include/header.html"-->
<!--#include virtual="/include/profile_subnav.html"-->
<div id="main-content" class="wrapper">
<div id="top-links"><a href="/profile">My Profile</a> » <a href="/profile/auth">Password & Authentication</a> » <span class="top-links-title">Enable Two-Factor Authentication</span></div>
<div id="twofactor">
<table class="lmc-table">
<thead>
<tr>
<td colspan="3">Enable Two-Factor Authentication</td>
</tr>
<tr>
<td colspan="3">Step 1</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Dscription</td>
<td colspan="2">Scan the QR code (or enter the key) into your two-factor application.</td>
</tr>
<tr class="lmc-tr3">
<td>Secret Key</td>
<td id="tfa-secret"></td>
<td class="info">Save this key in a safe place, it will only be shown once.</td>
</tr>
<tr class="lmc-tr3">
<td>QR Code</td>
<td id="qr-code"><img id="qr-code-img" src="//:0" alt="qr-code" /></td>
<td></td>
</tr>
</tbody>
<tbody class="lmc-tbody-head">
<tr class="noshow">
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3">Step 2</td>
</tr>
</tbody>
<tbody>
<tr class="lmc-tr3">
<td>Description</td>
<td colspan="2">Use your two-factor app to generate a token to verify everything is working correctly.</td>
</tr>
<tr class="lmc-tr3">
<td>Generated Token</td>
<td colspan="2"><input id="tfa-token" type="text" size="30" /></td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td colspan="2"><button disabled id="confirm-button" type="button">Confirm my token, and enable two-factor auth!</button></td>
</tr>
</tbody>
<tbody class="lmc-tbody-head">
<tr>
<td colspan="3">Recovery Procedure</td>
</tr>
</tbody>
</table>
<div id="recovery-procedure">
If you lose your token and get locked out of your account, email <a href="mailto:support@linode.com">support@linode.com</a> to regain access to your account.<br />
<br />
Should you need Linode to disable your Two-Factor Authentication, the following information is required:<br />
<ol>
<li>An image of the front and back of the payment card on file, which clearly shows both the last 6 digits and owner of the card</li>
<li>An image of the front and back of the matching government-issued photo ID</li>
</ol>
</div>
<div id="more-info" class="info">Read Linode's <a target="_blank" href="https://www.linode.com/docs/security/authentication/two-factor-authentication/linode-manager-security-controls/">two-factor authentication</a> documentation for more information.</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,52 @@
/*
* This file is part of Linode Manager Classic.
*
* Linode Manager Classic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Linode Manager Classic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
*/
@import url('/global.css');
.lmc-table:first-of-type tbody:not(.lmc-tbody-head) tr td:first-of-type {
font-weight: bold;
text-align: right;
}
#more-info {
font-size: 12px;
margin-top: 20px;
text-align: center;
}
#qr-code {
padding: 32px;
}
#qr-code-img {
display: inline-block;
height: 136px;
width: 136px;
}
#recovery-procedure {
font-size: 13.3px;
padding: 5px;
}
#tfa-secret {
font-family: monospace;
}
#twofactor {
padding: 15px 15px 15px;
}

View File

@ -0,0 +1,95 @@
/*
* This file is part of Linode Manager Classic.
*
* Linode Manager Classic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Linode Manager Classic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
*/
import { settings, elements, apiPost, parseParams, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.confirmButton = "confirm-button";
elements.qrCode = "qr-code-img";
elements.subnav = "subnav-link";
elements.subnavActive = "subnav-link-active";
elements.tfaSecret = "tfa-secret";
elements.tfaToken = "tfa-token";
// Data received from API calls
var data = {};
// Static references to UI elements
var ui = {};
ui.confirmButton = {};
ui.qrCode = {};
ui.tfaSecret = {};
ui.tfaToken = {};
// Callback for TFA API call
var displaySecret = function(response)
{
ui.tfaSecret.innerHTML = response.secret;
ui.confirmButton.disabled = false;
};
// Click handler for confirm button
var handleConfirm = function(event)
{
if (event.currentTarget.disabled)
return;
var req = {
"tfa_code": ui.tfaToken.value
};
apiPost("/profile/tfa-enable-confirm", req, function(response) {
alert("Your emergency scratch code is: " + response.scratch + "\nRecord this code and store it in a safe place. You will not be able to view it again!");
location.href = "/profile/auth";
});
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
setupHeader();
// Highlight the auth subnav link
var subnavLinks = document.getElementsByClassName(elements.subnav);
for (var i = 0; i < subnavLinks.length; i++) {
if (subnavLinks[i].pathname == "/profile/auth")
subnavLinks[i].className = elements.subnav + " " + elements.subnavActive;
else
subnavLinks[i].className = elements.subnav;
}
// Get element references
ui.confirmButton = document.getElementById(elements.confirmButton);
ui.qrCode = document.getElementById(elements.qrCode);
ui.tfaSecret = document.getElementById(elements.tfaSecret);
ui.tfaToken = document.getElementById(elements.tfaToken);
// Register event handlers
ui.confirmButton.addEventListener("click", handleConfirm);
// Get data from API
apiPost("/profile/tfa-enable", {}, displaySecret);
};
// Attach onload handler
window.addEventListener("load", setup);
})();