vari fix grafici

This commit is contained in:
zaccaria.majid
2023-05-25 17:06:30 +02:00
parent cc3b32f1d9
commit 5a1f5c2da9
11 changed files with 135 additions and 48 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2305.2512</h4>
<h4>Version: 0.9.2305.2516</h4>
<br /> Release note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2305.2512
0.9.2305.2516
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2305.2512</version>
<version>0.9.2305.2516</version>
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>
@@ -21,6 +21,59 @@ namespace WebDoorCreator.Data.Controllers
#region Public Methods
/// <summary>
/// Adding a new User
/// </summary>
/// <param name="addEditRec">Record to edit or add</param>
/// <returns></returns>
public async Task<bool> UserAddMod(AspNetUsers addEditRec)
{
bool fatto = false;
//List<ItemModel> dbResult = new List<ItemModel>();
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
var currRec = localDbCtx
.DbSetUsers
.Where(x => x.Id == addEditRec.Id)
.FirstOrDefault();
//if is not null edit the record found
if (currRec != null)
{
currRec.Id = addEditRec.Id;
currRec.UserName = addEditRec.UserName;
currRec.NormalizedUserName = addEditRec.NormalizedUserName;
currRec.Email = addEditRec.Email;
currRec.EmailConfirmed = addEditRec.EmailConfirmed;
currRec.LockoutEnabled = addEditRec.LockoutEnabled;
currRec.LockoutEnd = addEditRec.LockoutEnd;
currRec.ConcurrencyStamp = addEditRec.ConcurrencyStamp;
currRec.SecurityStamp = addEditRec.SecurityStamp;
currRec.AccessFailedCount = addEditRec.AccessFailedCount;
currRec.PhoneNumberConfirmed = addEditRec.PhoneNumberConfirmed;
currRec.PhoneNumber = addEditRec.PhoneNumber;
currRec.TwoFactorEnabled = addEditRec.TwoFactorEnabled;
localDbCtx.Entry(currRec).State = EntityState.Modified;
}
//if is null add the record as new in the table
else
{
localDbCtx
.DbSetUsers
.Add(addEditRec);
}
await localDbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante CompanyAddMod: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Adding a new company
/// </summary>
@@ -84,6 +84,20 @@ namespace WebDoorCreator.Data.Services
await Task.Delay(1);
return dbResult;
}
/// <summary>
/// Update company
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public async Task<bool> UserAddMod(AspNetUsers currRec)
{
var dbResult = await dbController.UserAddMod(currRec);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{Constants.rKeyCompany}");
bool answ = await ExecFlushRedisPattern(pattern);
await Task.Delay(1);
return dbResult;
}
/// <summary>
/// Company list filtered by company id
@@ -111,7 +111,7 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
private async Task CheckSuperAdmin()
{
//se non ci fosse --> creo samuele come superadmin
string superUser = "samuele@steamware.net";
string superUser = "zaccaria.majid01@egalware.com";
string superPwd = "viaDante16!";
string ADMIN_ROLE = "SuperAdmin";
var user = await _userManager.FindByEmailAsync(superUser);
@@ -43,7 +43,9 @@
<ul class="dropdown-menu p-2">
<li>
<div class="">
<button href="Identity/Account/Manage" class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none text-dark" style="">User options</button>
<NavLink class="nav-link" href="/Identity/Account/Manage">
<button class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none text-dark" style="">User options</button>
</NavLink>
</div>
</li>
<li>
+31 -15
View File
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.WebUtilities;
using System.Security;
using System.Text;
using System.Text.Encodings.Web;
using WebDoorCreator.Data.DbModels;
@@ -183,31 +184,45 @@ namespace WebDoorCreator.UI.Pages
NavManager.NavigateTo(NavManager.Uri, true);
}
}
protected PasswordHasher<IdentityUser> hasher = new PasswordHasher<IdentityUser>();
protected async Task addModNewUser()
{
Guid newCompToken = Guid.NewGuid();
bool done = false;
if (currUser == null)
{
var user = new IdentityUser { UserName = email, Email = email };
var result = await _userManager.CreateAsync(user, password);
//var user = new IdentityUser { UserName = email, Email = email };
//var result = await _userManager.CreateAsync(user, password);
if (result.Succeeded)
//if (result.Succeeded)
//{
// await _userManager.AddToRoleAsync(user, "User");
// var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
// code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
// var callbackUrl = $"/Account/ConfirmEmail?userId{user.Id}&code{code}&returnUrl=~/";
// await _emailSender.SendEmailAsync(email, "Web Door Creator: Please confirm your email account",
// $"<a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>Click here</a> to confirm the account linked with this email.");
// NavManager.NavigateTo(NavManager.Uri, true);
//}
AspNetUsers IU = new AspNetUsers()
{
await _userManager.AddToRoleAsync(user, "User");
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = $"/Account/ConfirmEmail?userId{user.Id}&code{code}&returnUrl=~/";
await _emailSender.SendEmailAsync(email, "Web Door Creator: Please confirm your email account",
$"<a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>Click here</a> to confirm the account linked with this email.");
NavManager.NavigateTo(NavManager.Uri, true);
}
UserName = email,
NormalizedUserName = email.ToUpper(),
Email = email,
NormalizedEmail = email.ToUpper(),
EmailConfirmed = true,
PasswordHash = hasher.HashPassword(null!, password),
LockoutEnabled = false,
AccessFailedCount = 0
};
done = await WDService.UserAddMod(IU);
}
else
{
#if false
var editComp = new CompanyModel()
{
CompanyId = companyId,
@@ -221,7 +236,8 @@ namespace WebDoorCreator.UI.Pages
PrivateNote = privateNote,
CompanyToken = companyToken
};
done = await WDService.CompanyAddMod(editComp);
done = await WDService.CompanyAddMod(editComp);
#endif
}
if (done)
+28 -26
View File
@@ -35,23 +35,23 @@
</head>
<body>
@*<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow">
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
@{
var result = Engine.FindView(ViewContext, "_LoginPartial", isMainPage: false);
}
@if (result.Success)
{
await Html.RenderPartialAsync("_LoginPartial");
}
else
{
throw new InvalidOperationException("The default Identity UI layout requires a partial view '_LoginPartial' " +
"usually located at '/Pages/_LoginPartial' or at '/Views/Shared/_LoginPartial' to work. Based on your configuration " +
$"we have looked at it in the following locations: {System.Environment.NewLine}{string.Join(System.Environment.NewLine, result.SearchedLocations)}.");
}
</div>
</nav>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow">
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
@{
var result = Engine.FindView(ViewContext, "_LoginPartial", isMainPage: false);
}
@if (result.Success)
{
await Html.RenderPartialAsync("_LoginPartial");
}
else
{
throw new InvalidOperationException("The default Identity UI layout requires a partial view '_LoginPartial' " +
"usually located at '/Pages/_LoginPartial' or at '/Views/Shared/_LoginPartial' to work. Based on your configuration " +
$"we have looked at it in the following locations: {System.Environment.NewLine}{string.Join(System.Environment.NewLine, result.SearchedLocations)}.");
}
</div>
</nav>
</header>*@
<div id="blazor-error-ui">
<environment include="Staging,Production">
@@ -63,17 +63,19 @@
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
@RenderBody()
<div class="px-4">
@RenderBody()
</div>
@*<div class="fixed-bottom bottom-row px-2">
<div class="row bg-dark text-light">
<div class="col-5 pe-0 text-left">
<b>Web Door Creator @(DateTime.Today.Year)</b>
</div>
<div class="col-7 ps-0 text-end">
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | Powered by: <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="~/images/LogoEgw.png" /> Egalware </a>
</div>
</div>
<div class="row bg-dark text-light">
<div class="col-5 pe-0 text-left">
<b>Web Door Creator @(DateTime.Today.Year)</b>
</div>
<div class="col-7 ps-0 text-end">
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | Powered by: <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="~/images/LogoEgw.png" /> Egalware </a>
</div>
</div>
</div>*@
@*<footer class="footer border-top pl-3 text-muted">
+1 -1
View File
@@ -18,7 +18,7 @@
@if (NavManager.Uri == NavManager.BaseUri)
{
<article class="p-0 content">
<article class="px-0 content">
@Body
</article>
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2305.2512</Version>
<Version>0.9.2305.2516</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>