Add user editing
This commit is contained in:
parent
3821e24748
commit
6d2a6be636
@ -13,7 +13,7 @@ export default {
|
||||
});
|
||||
if (!target) return response.status(404).send({ message: "User does not exists" });
|
||||
|
||||
if (await global.database.users.findOne({
|
||||
if (username != newname && await global.database.users.findOne({
|
||||
where: { username: newname },
|
||||
})) return response.status(409).send({ message: "Another user with this name already exists" });
|
||||
|
||||
|
@ -11,16 +11,88 @@
|
||||
padding: 5px;
|
||||
}
|
||||
tr:hover {background-color: #D6EEEE;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function deleteUser(username) {
|
||||
fetch(`/api/users/${username}`, {
|
||||
method: "DELETE",
|
||||
})
|
||||
.then(async (response) => {
|
||||
const res = await response.json();
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
/*background-color: black;*/
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Add padding to containers */
|
||||
.container {
|
||||
padding: 16px;
|
||||
background-color: white;
|
||||
display: block;
|
||||
position: relative;
|
||||
padding-left: 35px;
|
||||
margin-bottom: 12px;
|
||||
cursor: pointer;
|
||||
font-size: 22px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* Full-width input fields */
|
||||
input[type=text], input[type=password] {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
margin: 5px 0 22px 0;
|
||||
display: inline-block;
|
||||
border: none;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
input[type=text]:focus, input[type=password]:focus {
|
||||
background-color: #ddd;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Overwrite default styles of hr */
|
||||
hr {
|
||||
border: 1px solid #f1f1f1;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
/* Set a style for the submit button */
|
||||
.registerbtn {
|
||||
background-color: #04AA6D;
|
||||
color: white;
|
||||
padding: 16px 20px;
|
||||
margin: 8px 0;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.registerbtn:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Add a blue text color to links */
|
||||
a {
|
||||
color: dodgerblue;
|
||||
}
|
||||
|
||||
/* Set a grey background color and center the text of the "sign in" section */
|
||||
.signin {
|
||||
background-color: #f1f1f1;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function deleteUser(username) {
|
||||
fetch(`/api/users/${username}`, {
|
||||
method: "DELETE",
|
||||
})
|
||||
.then(async (response) => {
|
||||
const res = await response.json();
|
||||
console.log(res);
|
||||
if(!response.ok) return alert(res.message);
|
||||
location.reload();
|
||||
|
Loading…
Reference in New Issue
Block a user