Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgradingtonet8 #464

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions BlazorHero.CleanArchitecture.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{0317DF35-F5C5-4986-BA37-40C28554268F}"
EndProject
Expand Down Expand Up @@ -47,6 +47,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.Shared", "sr
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{161B234C-6018-4CE5-86B2-0EA95A53982D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{101E0C35-E865-48FD-A2D8-C1CB532EC8EA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -107,6 +109,7 @@ Global
{34B1D3CA-BBB6-449E-82A7-DF2BDBC9838F} = {0317DF35-F5C5-4986-BA37-40C28554268F}
{6B3A1D03-E35E-4579-A24A-E3343D024B4B} = {885BB018-5B07-4038-B061-71B70188933B}
{BFAD2E2A-8C7C-4357-9C81-D2ECDEEFC0F1} = {39A93E2F-51DE-47C0-93AF-A24561630C18}
{101E0C35-E865-48FD-A2D8-C1CB532EC8EA} = {1D491AAE-7A45-4B6B-9E3B-F8F3F0EFDED5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ED3E6669-AEC5-4A3B-9E57-2A81DE87BAAF}
Expand Down
26,129 changes: 26,129 additions & 0 deletions NewReport1.upgrade.json

Large diffs are not rendered by default.

24 changes: 11 additions & 13 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>BlazorHero.CleanArchitecture.Application</RootNamespace>
<AssemblyName>BlazorHero.CleanArchitecture.Application</AssemblyName>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="FluentValidation" Version="10.3.6" />
<PackageReference Include="LazyCache" Version="2.4.0" />
<PackageReference Include="MediatR" Version="10.0.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="10.0.1" />
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.15" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Features\Brands\Commands\AddEdit\AddEditBrandCommandHandler.ar.resx">
<Generator></Generator>
<Generator>
</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Features\Brands\Commands\Delete\DeleteBrandCommandHandler.ar.resx">
<Generator></Generator>
<Generator>
</Generator>
</EmbeddedResource>
</ItemGroup>

</Project>
</Project>
23 changes: 14 additions & 9 deletions src/Application/Configurations/AppConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
namespace BlazorHero.CleanArchitecture.Application.Configurations
namespace BlazorHero.CleanArchitecture.Application.Configurations;

public class AppConfiguration
{
public class AppConfiguration
{
public string Secret { get; set; }
public string Secret { get; set; }

public bool BehindSSLProxy { get; set; }

public bool BehindSSLProxy { get; set; }
public string ProxyIP { get; set; }

public string ProxyIP { get; set; }
public string ApplicationUrl { get; set; }
}

public string ApplicationUrl { get; set; }
}
}
public class PasswordPolicy
{
public bool PasswordCanExpire { get; set; }
public int PasswordLifeTimeinDays { get; set; }
}
3 changes: 2 additions & 1 deletion src/Application/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public static class ServiceCollectionExtensions
public static void AddApplicationLayer(this IServiceCollection services)
{
services.AddAutoMapper(Assembly.GetExecutingAssembly());
services.AddMediatR(cfg=>cfg.RegisterServicesFromAssemblies(Assembly.GetExecutingAssembly()));
//services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
services.AddMediatR(Assembly.GetExecutingAssembly());
// services.AddMediatR(Assembly.GetExecutingAssembly());
//services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
}

Expand Down
2 changes: 2 additions & 0 deletions src/Application/Interfaces/Services/Identity/IUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BlazorHero.CleanArchitecture.Application.Requests.Identity;
using BlazorHero.CleanArchitecture.Application.Responses.Identity;
using BlazorHero.CleanArchitecture.Shared.Wrapper;

using System.Collections.Generic;
using System.Threading.Tasks;

Expand All @@ -24,6 +25,7 @@ public interface IUserService : IService
Task<IResult> UpdateRolesAsync(UpdateUserRolesRequest request);

Task<IResult<string>> ConfirmEmailAsync(string userId, string code);
Task<IResult> SendConfirmEmailAsync(GetConfirmationLinkRequest request);

Task<IResult> ForgotPasswordAsync(ForgotPasswordRequest request, string origin);

Expand Down
12 changes: 12 additions & 0 deletions src/Application/Requests/Identity/GetConfirmationLinkRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace BlazorHero.CleanArchitecture.Application.Requests.Identity;

public class GetConfirmationLinkRequest
{
public GetConfirmationLinkRequest(string userId, string origin)
{
UserId = userId;
Origin = origin;
}
public string UserId { get; init; }
public string Origin { get; init; }
}
1 change: 1 addition & 0 deletions src/Application/Responses/Identity/TokenResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public class TokenResponse
public string RefreshToken { get; set; }
public string UserImageURL { get; set; }
public DateTime RefreshTokenExpiryTime { get; set; }
public bool PasswordExpired { get; set; }= false;
}
}
13 changes: 5 additions & 8 deletions src/Client.Infrastructure/Client.Infrastructure.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>BlazorHero.CleanArchitecture.Client.Infrastructure</RootNamespace>
<AssemblyName>BlazorHero.CleanArchitecture.Client.Infrastructure</AssemblyName>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
<PackageReference Include="MudBlazor" Version="6.0.2" />
<PackageReference Include="MudBlazor" Version="6.19.1" />
<PackageReference Include="Blazored.LocalStorage" Version="4.1.5" />
<PackageReference Include="Toolbelt.Blazor.HttpClientInterceptor" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Application\Application.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ public async Task<IResult> Login(TokenRequest model)
var token = result.Data.Token;
var refreshToken = result.Data.RefreshToken;
var userImageURL = result.Data.UserImageURL;
var passwordExpired = result.Data.PasswordExpired;

await _localStorage.SetItemAsync(StorageConstants.Local.AuthToken, token);
await _localStorage.SetItemAsync(StorageConstants.Local.AuthToken, token);
await _localStorage.SetItemAsync(StorageConstants.Local.RefreshToken, refreshToken);
await _localStorage.SetItemAsync(StorageConstants.Local.PassWordExpired, passwordExpired);
if (!string.IsNullOrEmpty(userImageURL))
{
await _localStorage.SetItemAsync(StorageConstants.Local.UserImageURL, userImageURL);
Expand All @@ -75,6 +79,8 @@ public async Task<IResult> Logout()
await _localStorage.RemoveItemAsync(StorageConstants.Local.AuthToken);
await _localStorage.RemoveItemAsync(StorageConstants.Local.RefreshToken);
await _localStorage.RemoveItemAsync(StorageConstants.Local.UserImageURL);
await _localStorage.RemoveItemAsync(StorageConstants.Local.PassWordExpired);

((BlazorHeroStateProvider)_authenticationStateProvider).MarkUserAsLoggedOut();
_httpClient.DefaultRequestHeaders.Authorization = null;
return await Result.SuccessAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface IUserManager : IManager
Task<IResult<UserRolesResponse>> GetRolesAsync(string userId);

Task<IResult> RegisterUserAsync(RegisterRequest request);
Task<IResult> ResendConfirmationMailAsync(string userId);

Task<IResult> ToggleUserStatusAsync(ToggleUserStatusRequest request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BlazorHero.CleanArchitecture.Application.Responses.Identity;
using BlazorHero.CleanArchitecture.Client.Infrastructure.Extensions;
using BlazorHero.CleanArchitecture.Shared.Wrapper;

using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
Expand Down Expand Up @@ -35,6 +36,11 @@ public async Task<IResult> RegisterUserAsync(RegisterRequest request)
var response = await _httpClient.PostAsJsonAsync(Routes.UserEndpoints.Register, request);
return await response.ToResult();
}
public async Task<IResult> ResendConfirmationMailAsync(string userId)
{
var response = await _httpClient.PostAsJsonAsync(Routes.UserEndpoints.ResendMail, userId);
return await response.ToResult();
}

public async Task<IResult> ToggleUserStatusAsync(ToggleUserStatusRequest request)
{
Expand Down
1 change: 1 addition & 0 deletions src/Client.Infrastructure/Routes/UserEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public static string ExportFiltered(string searchString)
public static string ToggleUserStatus = "api/identity/user/toggle-status";
public static string ForgotPassword = "api/identity/user/forgot-password";
public static string ResetPassword = "api/identity/user/reset-password";
public static string ResendMail = "api/identity/user/resend-mail";
}
}
2 changes: 1 addition & 1 deletion src/Client.Infrastructure/Settings/ClientPreference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public record ClientPreference : IPreference
public bool IsRTL { get; set; }
public bool IsDrawerOpen { get; set; }
public string PrimaryColor { get; set; }
public string LanguageCode { get; set; } = LocalizationConstants.SupportedLanguages.FirstOrDefault()?.Code ?? "en-US";
public string LanguageCode { get; set; } = LocalizationConstants.SupportedLanguages.FirstOrDefault()?.Code ?? "fr-FR";
}
}
33 changes: 12 additions & 21 deletions src/Client/Client.csproj
Original file line number Diff line number Diff line change
@@ -1,48 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
<RootNamespace>BlazorHero.CleanArchitecture.Client</RootNamespace>
<AssemblyName>BlazorHero.CleanArchitecture.Client</AssemblyName>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<Content Remove="Shared\Components\BlazorHeroLogo.razor" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blazored.FluentValidation" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.1" />
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
<PackageReference Include="MudBlazor" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="8.0.4" />
<PackageReference Include="Blazored.LocalStorage" Version="4.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.4" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<UpToDateCheckInput Remove="Shared\Components\BlazorHeroLogo.razor" />
</ItemGroup>

<ItemGroup>
<_ContentIncludedByDefault Remove="Shared\Components\BlazorHeroLogo.razor" />
</ItemGroup>

<ItemGroup>
<None Include="Shared\Components\BlazorHeroLogo.razor" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Client.Infrastructure\Client.Infrastructure.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Client/Pages/Identity/Reset.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override void OnInitialized()
var uri = _navigationManager.ToAbsoluteUri(_navigationManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("Token", out var param))
{
var queryToken = param.First();
var queryToken = param[0];
_resetPasswordModel.Token = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(queryToken));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/Identity/Security.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@inject Microsoft.Extensions.Localization.IStringLocalizer<Security> _localizer

@page "/change-password/"
<EditForm Model="@_passwordModel" OnValidSubmit="ChangePasswordAsync">
<FluentValidationValidator @ref="_fluentValidationValidator" />
<MudCard Elevation="25">
Expand Down
2 changes: 2 additions & 0 deletions src/Client/Pages/Identity/Users.razor
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ else
{
<MudMenuItem OnClick="(()=>ManageRoles(context.Id, context.Email))">@_localizer["Manage Roles"]</MudMenuItem>
}
<MudMenuItem OnClick="(()=>SendMail(context.Id))">@_localizer["(Re) Send Confimation Mail"]</MudMenuItem>

</MudMenu>
</MudTd>
</RowTemplate>
Expand Down
5 changes: 5 additions & 0 deletions src/Client/Pages/Identity/Users.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using BlazorHero.CleanArchitecture.Shared.Constants.Permission;
using Microsoft.AspNetCore.Authorization;
using Microsoft.JSInterop;
using Polly;

namespace BlazorHero.CleanArchitecture.Client.Pages.Identity
{
Expand Down Expand Up @@ -118,5 +119,9 @@ private void ManageRoles(string userId, string email)
if (email == "mukesh@blazorhero.com") _snackBar.Add(_localizer["Not Allowed."], Severity.Error);
else _navigationManager.NavigateTo($"/identity/user-roles/{userId}");
}
private void SendMail(string userId)
{
_userManager.ResendConfirmationMailAsync(userId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
else if (AddEditExtendedAttributeModel.Type == EntityExtendedAttributeType.DateTime)
{
<MudItem xs="12" md="6">
<MudDatePicker @ref="_datePicker" PickerVariant="PickerVariant.Dialog" @bind-Date="AddEditExtendedAttributeModel.DateTime" Label="@_localizer["Date"]">
<MudDatePicker Context="ctx" @ref="_datePicker" PickerVariant="PickerVariant.Dialog" @bind-Date="AddEditExtendedAttributeModel.DateTime" Label="@_localizer["Date"]">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _datePicker.Clear())">@_localizer["Clear"]</MudButton>
<MudButton OnClick="@(() => _datePicker.Close(false))">@_localizer["Cancel"]</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _datePicker.Close())">@_localizer["Ok"]</MudButton>
</PickerActions>
</MudDatePicker>

<MudTimePicker @ref="_timePicker" PickerVariant="PickerVariant.Dialog" Label="@_localizer["Time"]" @bind-Time="_time">
<MudTimePicker Context="ctx2" @ref="_timePicker" PickerVariant="PickerVariant.Dialog" Label="@_localizer["Time"]" @bind-Time="_time">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _timePicker.Clear())">@_localizer["Clear"]</MudButton>
<MudButton OnClick="@(() => _timePicker.Close(false))">@_localizer["Cancel"]</MudButton>
Expand Down
Loading