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

Resolved issue in TenantManager resulting in "No database provider has been configured for this DbContext" error being logged during startup. Added logic to update email address in AspNetUsers when updating a User. #2065

Merged
merged 1 commit into from
Mar 16, 2022
Merged
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
9 changes: 5 additions & 4 deletions Oqtane.Server/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,15 @@ public async Task<User> Put(int id, [FromBody] User user)
{
if (ModelState.IsValid && user.SiteId == _tenantManager.GetAlias().SiteId && _users.GetUser(user.UserId, false) != null && (User.IsInRole(RoleNames.Admin) || User.Identity.Name == user.Username))
{
if (user.Password != "")
IdentityUser identityuser = await _identityUserManager.FindByNameAsync(user.Username);
if (identityuser != null)
{
IdentityUser identityuser = await _identityUserManager.FindByNameAsync(user.Username);
if (identityuser != null)
identityuser.Email = user.Email;
if (user.Password != "")
{
identityuser.PasswordHash = _identityUserManager.PasswordHasher.HashPassword(identityuser, user.Password);
await _identityUserManager.UpdateAsync(identityuser);
}
await _identityUserManager.UpdateAsync(identityuser);
}
user = _users.UpdateUser(user);
_syncManager.AddSyncEvent(_tenantManager.GetAlias().TenantId, EntityNames.User, user.UserId);
Expand Down
17 changes: 0 additions & 17 deletions Oqtane.Server/Infrastructure/Options/SiteOptionsFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,6 @@ public TOptions Create(string name)
post.PostConfigure(name, options);
}

//if (_validations.Length > 0)
//{
// var failures = new List<string>();
// foreach (IValidateOptions<TOptions> validate in _validations)
// {
// ValidateOptionsResult result = validate.Validate(name, options);
// if (result != null && result.Failed)
// {
// failures.AddRange(result.Failures);
// }
// }
// if (failures.Count > 0)
// {
// throw new OptionsValidationException(name, typeof(TOptions), failures);
// }
//}

return options;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Oqtane.Server/Infrastructure/TenantManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Alias GetAlias()
{
Alias alias = null;

if (_siteState != null && _siteState.Alias != null && _siteState.Alias.AliasId != -1)
if (_siteState?.Alias != null && _siteState.Alias.AliasId != -1)
{
alias = _siteState.Alias;
}
Expand Down Expand Up @@ -63,7 +63,7 @@ public Alias GetAlias()

public Tenant GetTenant()
{
var alias = GetAlias();
var alias = _siteState?.Alias;
if (alias != null)
{
// return tenant details
Expand Down