dogfooding fixes
This commit is contained in:
parent
d83ec1827a
commit
683ad8959a
@ -92,6 +92,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_togglepassword = Localizer["ShowPassword"];
|
_togglepassword = Localizer["ShowPassword"];
|
||||||
|
|
||||||
@ -134,6 +136,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Loading Login {Error}", ex.Message);
|
||||||
|
AddModuleMessage(Localizer["Error.LoadLogin"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
@ -144,6 +152,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task Login()
|
private async Task Login()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
validated = true;
|
validated = true;
|
||||||
var interop = new Interop(JSRuntime);
|
var interop = new Interop(JSRuntime);
|
||||||
@ -206,6 +216,12 @@
|
|||||||
AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
|
AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Performing Login {Error}", ex.Message);
|
||||||
|
AddModuleMessage(Localizer["Error.Login"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Cancel()
|
private void Cancel()
|
||||||
{
|
{
|
||||||
@ -213,6 +229,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task Forgot()
|
private async Task Forgot()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (_username != string.Empty)
|
if (_username != string.Empty)
|
||||||
{
|
{
|
||||||
@ -235,6 +253,12 @@
|
|||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Resetting Password {Error}", ex.Message);
|
||||||
|
AddModuleMessage(Localizer["Error.ResetPassword"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Reset()
|
private void Reset()
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log.PageId != null && log.ModuleId != null)
|
if (log.PageId != null && log.ModuleId != null && log.ModuleId != -1)
|
||||||
{
|
{
|
||||||
var pagemodule = await PageModuleService.GetPageModuleAsync(log.PageId.Value, log.ModuleId.Value);
|
var pagemodule = await PageModuleService.GetPageModuleAsync(log.PageId.Value, log.ModuleId.Value);
|
||||||
if (pagemodule != null)
|
if (pagemodule != null)
|
||||||
|
@ -192,4 +192,13 @@
|
|||||||
<data name="Use" xml:space="preserve">
|
<data name="Use" xml:space="preserve">
|
||||||
<value>Use</value>
|
<value>Use</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Error.LoadLogin" xml:space="preserve">
|
||||||
|
<value>Error Loading Login</value>
|
||||||
|
</data>
|
||||||
|
<data name="Error.Login" xml:space="preserve">
|
||||||
|
<value>Error Performing Login</value>
|
||||||
|
</data>
|
||||||
|
<data name="Error.ResetPassword" xml:space="preserve">
|
||||||
|
<value>Error Resetting Password</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -34,7 +34,7 @@ namespace Oqtane.Themes.Controls
|
|||||||
protected async Task LogoutUser()
|
protected async Task LogoutUser()
|
||||||
{
|
{
|
||||||
await UserService.LogoutUserAsync(PageState.User);
|
await UserService.LogoutUserAsync(PageState.User);
|
||||||
await LoggingService.Log(PageState.Alias, PageState.Page.PageId, PageState.ModuleId, PageState.User.UserId, GetType().AssemblyQualifiedName, "Logout", LogFunction.Security, LogLevel.Information, null, "User Logout For Username {Username}", PageState.User.Username);
|
await LoggingService.Log(PageState.Alias, PageState.Page.PageId, null, PageState.User.UserId, GetType().AssemblyQualifiedName, "Logout", LogFunction.Security, LogLevel.Information, null, "User Logout For Username {Username}", PageState.User.Username);
|
||||||
PageState.User = null;
|
PageState.User = null;
|
||||||
|
|
||||||
var url = PageState.Alias.Path + "/" + PageState.Page.Path;
|
var url = PageState.Alias.Path + "/" + PageState.Page.Path;
|
||||||
|
@ -184,7 +184,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||||||
options.SignIn.RequireConfirmedPhoneNumber = false;
|
options.SignIn.RequireConfirmedPhoneNumber = false;
|
||||||
|
|
||||||
// User settings
|
// User settings
|
||||||
options.User.RequireUniqueEmail = true;
|
options.User.RequireUniqueEmail = false; // changing to true will cause issues for legacy data
|
||||||
options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
|
options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -199,8 +199,24 @@ namespace Oqtane.Extensions
|
|||||||
}
|
}
|
||||||
User user = null;
|
User user = null;
|
||||||
|
|
||||||
var identityuser = await _identityUserManager.FindByEmailAsync(email);
|
bool duplicates = false;
|
||||||
|
IdentityUser identityuser = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
identityuser = await _identityUserManager.FindByEmailAsync(email);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// FindByEmailAsync will throw an error if the email matches multiple user accounts
|
||||||
|
duplicates = true;
|
||||||
|
}
|
||||||
if (identityuser == null)
|
if (identityuser == null)
|
||||||
|
{
|
||||||
|
if (duplicates)
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "Multiple Users Exist With Email Address {Email}. Login Denied.", email);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (bool.Parse(httpContext.GetSiteSettings().GetValue("ExternalLogin:CreateUsers", "true")))
|
if (bool.Parse(httpContext.GetSiteSettings().GetValue("ExternalLogin:CreateUsers", "true")))
|
||||||
{
|
{
|
||||||
@ -250,6 +266,7 @@ namespace Oqtane.Extensions
|
|||||||
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "Creation Of New Users Is Disabled For This Site. User With Email Address {Email} Will First Need To Be Registered On The Site.", email);
|
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "Creation Of New Users Is Disabled For This Site. User With Email Address {Email} Will First Need To Be Registered On The Site.", email);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var logins = await _identityUserManager.GetLoginsAsync(identityuser);
|
var logins = await _identityUserManager.GetLoginsAsync(identityuser);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user