Skip to content

Commit e7c9b00

Browse files
authored
Merge pull request #37 from Nesteo/management-interface
Management interface
2 parents 45879f5 + b424611 commit e7c9b00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4365
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,4 @@ appsettings.Development.json
270270
# Compose env
271271
.env
272272
/Nesteo.Server.DataImport/Data/
273+
/Nesteo.Server/wwwroot/

Dockerfile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,31 @@ RUN dotnet publish /src/Nesteo.Server/Nesteo.Server.csproj -c Release -o /app --
1414
RUN dotnet publish /src/Nesteo.Server.SampleDataGenerator/Nesteo.Server.SampleDataGenerator.csproj -c Release -o /app --runtime debian-x64
1515

1616

17+
### Compile management frontend
18+
19+
# NodeJS-Image
20+
FROM node:latest AS build-web
21+
22+
# Copy source code to /src
23+
COPY . /src
24+
WORKDIR /src/Nesteo.Server
25+
26+
# Restore packages
27+
RUN npm install --with-dev
28+
29+
# Run build task
30+
RUN npx grunt default
31+
32+
1733
### Build final image
1834

19-
# Minimal base iamge without dotnet runtime
35+
# Minimal base image without dotnet runtime
2036
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.0-buster-slim
2137

2238
# Copy self contained app to /app
2339
WORKDIR /app
2440
COPY --from=build /app .
41+
COPY --from=build-web /src/Nesteo.Server/wwwroot ./wwwroot/
2542

2643
# Add curl for health check execution
2744
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

Nesteo.Server/Authentication/CookieAuthenticationConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void Configure(CookieAuthenticationOptions options) { }
1212
public void Configure(string name, CookieAuthenticationOptions options)
1313
{
1414
if (name != IdentityConstants.ApplicationScheme)
15-
throw new InvalidOperationException($"Cannot configure unknown cookie authentication scheme {name}");
15+
return;
1616

1717
options.Cookie.Name = "sessionToken";
1818
options.Cookie.HttpOnly = true;

Nesteo.Server/MappingProfiles/ModelMappingProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class ModelMappingProfile : Profile
1010
{
1111
public ModelMappingProfile()
1212
{
13-
CreateMap<UserEntity, User>();
13+
CreateMap<UserEntity, User>().ReverseMap();
1414
CreateMap<RegionEntity, Region>().ReverseMap();
1515
CreateMap<OwnerEntity, Owner>().ReverseMap();
1616
CreateMap<SpeciesEntity, Species>().ReverseMap();

Nesteo.Server/Nesteo.Server.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<ItemGroup>
1414
<Folder Include="Properties" />
1515
<Folder Include="wwwroot" />
16+
<Folder Include="wwwroot\js" />
1617
</ItemGroup>
1718

1819
<ItemGroup>
@@ -38,10 +39,6 @@
3839
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
3940
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
4041
</Content>
41-
<Content Include="Pages\.gitkeep">
42-
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
43-
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
44-
</Content>
4542
</ItemGroup>
4643

4744
</Project>

Nesteo.Server/Pages/.gitkeep

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page "/access-denied"
2+
@model AccessDeniedModel
3+
@{
4+
ViewData["Title"] = "Access denied";
5+
}
6+
7+
<header>
8+
<h2 class="text-danger">@ViewData["Title"]</h2>
9+
<p class="text-danger">Sorry, you're not allowed to do this.</p>
10+
</header>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using Microsoft.AspNetCore.Mvc.RazorPages;
2+
3+
namespace Nesteo.Server.Pages.Auth
4+
{
5+
public class AccessDeniedModel : PageModel { }
6+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page "/lockout"
2+
@model LockoutModel
3+
@{
4+
ViewData["Title"] = "Account locked";
5+
}
6+
7+
<header>
8+
<h2 class="text-danger">@ViewData["Title"]</h2>
9+
<p class="text-danger">Your account has been temporarily disabled. Please try again later.</p>
10+
</header>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using Microsoft.AspNetCore.Authorization;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace Nesteo.Server.Pages.Auth
5+
{
6+
public class LockoutModel : PageModel { }
7+
}

0 commit comments

Comments
 (0)