diff --git a/Oqtane.Server/Controllers/UserController.cs b/Oqtane.Server/Controllers/UserController.cs index 4f938c69d..12f3eb99c 100644 --- a/Oqtane.Server/Controllers/UserController.cs +++ b/Oqtane.Server/Controllers/UserController.cs @@ -254,14 +254,15 @@ public async Task 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); diff --git a/Oqtane.Server/Infrastructure/Options/SiteOptionsFactory.cs b/Oqtane.Server/Infrastructure/Options/SiteOptionsFactory.cs index 1c719c7c5..0a9f4c4fc 100644 --- a/Oqtane.Server/Infrastructure/Options/SiteOptionsFactory.cs +++ b/Oqtane.Server/Infrastructure/Options/SiteOptionsFactory.cs @@ -54,23 +54,6 @@ public TOptions Create(string name) post.PostConfigure(name, options); } - //if (_validations.Length > 0) - //{ - // var failures = new List(); - // foreach (IValidateOptions 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; } } diff --git a/Oqtane.Server/Infrastructure/TenantManager.cs b/Oqtane.Server/Infrastructure/TenantManager.cs index 4a1de172a..616e46107 100644 --- a/Oqtane.Server/Infrastructure/TenantManager.cs +++ b/Oqtane.Server/Infrastructure/TenantManager.cs @@ -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; } @@ -63,7 +63,7 @@ public Alias GetAlias() public Tenant GetTenant() { - var alias = GetAlias(); + var alias = _siteState?.Alias; if (alias != null) { // return tenant details