Fixed bug, that broke UUID changer when user provides spaces in UUID. (#102)

fixed bug

Co-authored-by: mikolaj widla <mikolaj.widla@gmail.com>
Reviewed-on: R11/release11-tools-web#102
Co-authored-by: Mikolaj Widla <widlam@noreply.example.com>
Co-committed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
2023-03-06 15:05:51 +01:00
committed by Adam Bem
parent 9135a9221f
commit 599bcf96b2
2 changed files with 5 additions and 2 deletions

View File

@@ -280,9 +280,10 @@ async function fetchUUIDCheck(givenUUID , strategy){
}
function checkUUIDChars(uuid) {
uuid.replace(/ /g,'')
console.log("UUID in check: " + uuid);
const regex = new RegExp("^[A-z0-9-]+$");
if(regex.test(uuid)){
if(regex.test(uuid) || uuid == ""){
return uuid ;
}
return "invalid";
@@ -309,7 +310,6 @@ function changeUUID(element){
changeMessage = "success";
}
clientUUID = data;
$("#uuid-input").attr("disabled", true);
$("#editable").attr("checked", false);
uuidChangeModalDisplay(changeMessage);

View File

@@ -74,13 +74,16 @@ function showModal(jmodal){
function hideModal(jmodal){
if(!modalDisplayed) return;
if ($(uuidChangeModal).hasClass('active')) window.location.reload();
overlay.removeClass('active');
jmodal.removeClass('active');
modalDisplayed = false;
}
btnModalClose.click(closeModals);
overlay.click(closeModals);
dataLossModalNo.click(closeModals);
dataLossModalYes.click(dropChangesAndClose);