Add user editing

This commit is contained in:
Ninjdai 2023-12-12 16:35:22 +01:00
parent 3821e24748
commit 6d2a6be636
2 changed files with 84 additions and 12 deletions

View File

@ -13,7 +13,7 @@ export default {
}); });
if (!target) return response.status(404).send({ message: "User does not exists" }); 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 }, where: { username: newname },
})) return response.status(409).send({ message: "Another user with this name already exists" }); })) return response.status(409).send({ message: "Another user with this name already exists" });

View File

@ -11,9 +11,81 @@
padding: 5px; padding: 5px;
} }
tr:hover {background-color: #D6EEEE;} tr:hover {background-color: #D6EEEE;}
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> </style>
</head> </head>
<body> <body>
<script> <script>
function deleteUser(username) { function deleteUser(username) {
fetch(`/api/users/${username}`, { fetch(`/api/users/${username}`, {