fix #2512 - provide guidance about password complexity policy during install, and ensure modified passwords meet complexity policy
This commit is contained in:
		| @ -201,58 +201,64 @@ else | ||||
| 						photofileid = -1; | ||||
| 						photo = null; | ||||
| 					} | ||||
|                     isdeleted = user.IsDeleted.ToString(); | ||||
| 					isdeleted = user.IsDeleted.ToString(); | ||||
| 					lastlogin = string.Format("{0:MMM dd yyyy HH:mm:ss}", user.LastLoginOn); | ||||
| 					lastipaddress = user.LastIPAddress; | ||||
|  | ||||
| 					settings = await SettingService.GetUserSettingsAsync(user.UserId); | ||||
|                     createdby = user.CreatedBy; | ||||
|                     createdon = user.CreatedOn; | ||||
|                     modifiedby = user.ModifiedBy; | ||||
|                     modifiedon = user.ModifiedOn; | ||||
|                     deletedby = user.DeletedBy; | ||||
|                     deletedon = user.DeletedOn; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Loading User {UserId} {Error}", userid, ex.Message); | ||||
|             AddModuleMessage(Localizer["Error.User.Load"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
| 					createdby = user.CreatedBy; | ||||
| 					createdon = user.CreatedOn; | ||||
| 					modifiedby = user.ModifiedBy; | ||||
| 					modifiedon = user.ModifiedOn; | ||||
| 					deletedby = user.DeletedBy; | ||||
| 					deletedon = user.DeletedOn; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		catch (Exception ex) | ||||
| 		{ | ||||
| 			await logger.LogError(ex, "Error Loading User {UserId} {Error}", userid, ex.Message); | ||||
| 			AddModuleMessage(Localizer["Error.User.Load"], MessageType.Error); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|     private string GetProfileValue(string SettingName, string DefaultValue) | ||||
|         => SettingService.GetSetting(settings, SettingName, DefaultValue); | ||||
| 	private string GetProfileValue(string SettingName, string DefaultValue) | ||||
| 		=> SettingService.GetSetting(settings, SettingName, DefaultValue); | ||||
|  | ||||
|     private async Task SaveUser() | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             if (username != string.Empty && email != string.Empty && ValidateProfiles()) | ||||
|             { | ||||
|                 if (_password == confirm) | ||||
|                 { | ||||
|                     var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId); | ||||
|                     user.SiteId = PageState.Site.SiteId; | ||||
|                     user.Username = username; | ||||
|                     user.Password = _password; | ||||
|                     user.Email = email; | ||||
|                     user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname; | ||||
|                     user.PhotoFileId = null; | ||||
|                     user.PhotoFileId = filemanager.GetFileId(); | ||||
|                     if (user.PhotoFileId == -1) | ||||
|                     { | ||||
|                         user.PhotoFileId = null; | ||||
|                     } | ||||
| 	private async Task SaveUser() | ||||
| 	{ | ||||
| 		try | ||||
| 		{ | ||||
| 			if (username != string.Empty && email != string.Empty && ValidateProfiles()) | ||||
| 			{ | ||||
| 				if (_password == confirm) | ||||
| 				{ | ||||
| 					var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId); | ||||
| 					user.SiteId = PageState.Site.SiteId; | ||||
| 					user.Username = username; | ||||
| 					user.Password = _password; | ||||
| 					user.Email = email; | ||||
| 					user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname; | ||||
| 					user.PhotoFileId = null; | ||||
| 					user.PhotoFileId = filemanager.GetFileId(); | ||||
| 					if (user.PhotoFileId == -1) | ||||
| 					{ | ||||
| 						user.PhotoFileId = null; | ||||
| 					} | ||||
|  | ||||
|                     user.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted)); | ||||
| 					user.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted)); | ||||
|  | ||||
|                     user = await UserService.UpdateUserAsync(user); | ||||
|                     await SettingService.UpdateUserSettingsAsync(settings, user.UserId); | ||||
|                     await logger.LogInformation("User Saved {User}", user); | ||||
|  | ||||
|                     NavigationManager.NavigateTo(NavigateUrl()); | ||||
| 					user = await UserService.UpdateUserAsync(user); | ||||
| 					if (user != null) | ||||
| 					{ | ||||
| 						await SettingService.UpdateUserSettingsAsync(settings, user.UserId); | ||||
| 						await logger.LogInformation("User Saved {User}", user); | ||||
| 						NavigationManager.NavigateTo(NavigateUrl()); | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						AddModuleMessage(Localizer["Message.Password.Complexity"], MessageType.Error); | ||||
| 					} | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker