Skip to content

Commit

Permalink
Merge pull request #92 from pappyangel/SQLInjection
Browse files Browse the repository at this point in the history
various minor fixes
  • Loading branch information
timrobertsusa authored Aug 13, 2024
2 parents 6ac4e25 + 566aee6 commit dd170d1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
31 changes: 12 additions & 19 deletions frontend/Pages/EditCocktail.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@

@* + (Model.cocktailToEdit.ImagePath ?? "NoImage.jpg"); *@

if (Model.cocktailToEdit.ImagePath is null)
srcContent = srcContent + "NoImageSelected.png";
else
if (Model.cocktailToEdit.ImagePath == "")
srcContent = srcContent + "NoImageSelected.png";
srcContent = srcContent + Model.cocktailToEdit.ImagePath;

if (Model.cocktailToEdit.ImagePath == "NoImageSelected.png")
userImageName = "Please select an image";
else
{
srcContent = srcContent + Model.cocktailToEdit.ImagePath;
userImageName = Model.cocktailToEdit.ImagePath.Substring(37);
}

userImageName = Model.cocktailToEdit.ImagePath.Substring(37);
}


Expand Down Expand Up @@ -69,23 +64,19 @@
</div>

<div class="form-group row">
<label asp-for="ctImage" class="col-sm-2 col-form-label"></label>
<label class="col-sm-2 col-form-label">Image</label>
<div class="col-sm-10">
<div class="custom-file">
@*Photo property type is IFormFile, so ASP.NET Core
automatically creates a FileUpload control *@
<input asp-for="ctImage" class="custom-file-input form-control">
<div class="custom-file">
<input asp-for="ctImage" class="custom-file-input form-control">
@* <label class="custom-file-label">Click here to change image</label> *@
<label class="custom-file-label">@userImageName</label>
</div>
</div>
</div>

@*Display the existing employee photo*@

<div class="form-group row col-sm-4 offset-4">
<img class="imageThumbnail" src="@srcContent" asp-append-version="true" />
<img id="imageThumbnail" height=auto width="175" src="@srcContent" asp-append-version="true" />
</div>


<div class="form-group row">
<div class="col-sm-10">
Expand All @@ -102,6 +93,8 @@
$('.custom-file-input').on("change", function () {
var fileName = $(this).val().split("\\").pop();
$(this).next('.custom-file-label').html(fileName);
var image = document.getElementById('imageThumbnail');
image.src = URL.createObjectURL(this.files[0]);
});
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</environment>
</p>
<p>Deployment Date: @Model.envDeploymentDate</p>
<p><a href="https://cocktail-api.azurewebsites.net/cocktails">Hit the API directly!</a></p>
<p><a href="https://cocktail-api.azurewebsites.net/cocktails" target="_blank">Hit the API directly!</a></p>
</div>


Expand Down
8 changes: 7 additions & 1 deletion frontend/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ public void OnGet()
{
envEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
envDeploymentDate = _config["DeploymentDate"];

if (envEnvironment == "Development")
{
var localNow = DateTimeOffset.Now;
var usEST = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
envDeploymentDate = TimeZoneInfo.ConvertTime(localNow, usEST).ToString("MM/dd/yyyy hh:mm tt");

}
}
}
}
2 changes: 1 addition & 1 deletion frontend/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"APIProductionUrl":"https://cocktail-api.azurewebsites.net/cocktails",
"FY25-APIProductionUrl": "https://cocktail-api.azurewebsites.net/cocktails",
"Dev-APIUrl": "http://127.0.0.1:5000/cocktails",
"DeploymentDate": "08/10/2024 10:24 AM"
"DeploymentDate": "09/11/1967 10:24 AM"
}
Binary file added frontend/wwwroot/images/NoImageSelected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dd170d1

Please sign in to comment.