force lower case on submit

This commit is contained in:
Christopher Bisset 2022-07-29 12:21:12 +10:00
parent c213fe42d2
commit d804dda875

View file

@ -16,7 +16,7 @@
function renameDeviceAction() {
if (editUserForm.reportValidity()) {
renameDevice(device.id, newDeviceName)
renameDevice(device.id, newDeviceName.toLowerCase())
.then((response) => {
cardEditing = false;
// refresh users after editing
@ -47,7 +47,7 @@
{:else}
<form bind:this={editUserForm} on:submit|preventDefault={renameDeviceAction}>
<!-- Input has to be lower case, but we will force lower case on submit -->
<input in:slide on:click|stopPropagation bind:value={newDeviceName} class="card-input mb-1 lowercase" required pattern="[a-zA-Z\-\.]+" placeholder="name" />
<input in:slide on:click|stopPropagation bind:value={newDeviceName} class="card-input mb-1 lowercase" required pattern="[a-zA-Z1-9\-\.]+" placeholder="name" />
<!-- edit accept symbol -->
<button in:fade on:click|stopPropagation class=""
><svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 inline flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">