Added Account section

This commit is contained in:
2020-03-13 23:01:39 -04:00
parent dd1809473c
commit 396ca2366e
80 changed files with 5330 additions and 107 deletions

27
user/add/add.css Normal file
View File

@ -0,0 +1,27 @@
/*
* 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');
#add {
padding: 15px 15px 15px;
}
tbody:not(.lmc-tbody-head) tr td:first-of-type {
font-weight: bold;
text-align: right;
}

80
user/add/add.js Normal file
View File

@ -0,0 +1,80 @@
/*
* 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.addButton = "add-button";
elements.email = "email";
elements.restrictedYes = "restricted-yes";
elements.user = "user";
// Data received from API calls
var data = {};
// Static references to UI elements
var ui = {};
ui.addButton = {};
ui.email = {};
ui.restrictedYes = {};
ui.user = {};
// Click handler for add button
var handleAdd = function(event)
{
var req = {
"username": ui.user.value,
"email": ui.email.value,
"restricted": ui.restrictedYes.checked
};
apiPost("/account/users", req, function(response)
{
location.href = "/user";
});
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
setupHeader();
// Highlight the account nav link
var navlinks = document.getElementsByClassName(elements.navlink);
for (var i = 0; i < navlinks.length; i++) {
if (navlinks[i].pathname == "/account/")
navlinks[i].className = " " + elements.navlinkActive;
}
// Get element references
ui.addButton = document.getElementById(elements.addButton);
ui.email = document.getElementById(elements.email);
ui.restrictedYes = document.getElementById(elements.restrictedYes);
ui.user = document.getElementById(elements.user);
// Attach event handlers
ui.addButton.addEventListener("click", handleAdd);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

66
user/add/index.shtml Normal file
View File

@ -0,0 +1,66 @@
<!--
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 - Account // Add User</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="add.css" />
<script src="add.js" type="module"></script>
</head>
<body>
<!--#include virtual="/include/header.html"-->
<!--#include virtual="/include/account_subnav.html"-->
<div id="main-content" class="wrapper">
<div id="add">
<table class="lmc-table">
<thead>
<tr>
<td colspan="2">Add User</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Username</td>
<td><input id="user" type="text" size="24" /></td>
</tr>
<tr class="lmc-tr3">
<td>Password</td>
<td>A password creation link will be emailed to the user</td>
</tr>
<tr class="lmc-tr3">
<td>Email</td>
<td><input id="email" type="email" size="24" /></td>
</tr>
<tr class="lmc-tr3">
<td>Restricted User</td>
<td>
<input checked id="restricted-yes" type="radio" name="restricted" /> <label for="restricted-yes">Yes - this user can only do what I specify</label><br />
<input id="restricted-no" type="radio" name="restricted" /> <label for="restricted-no">No - this user has no access restrictions</label>
</td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button id="add-button" type="button">Add User</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>