diff --git a/Oqtane.Client/Modules/Admin/Users/Add.razor b/Oqtane.Client/Modules/Admin/Users/Add.razor index b1c34d4f..817bf5e1 100644 --- a/Oqtane.Client/Modules/Admin/Users/Add.razor +++ b/Oqtane.Client/Modules/Admin/Users/Add.razor @@ -17,7 +17,7 @@
- +
@@ -33,7 +33,7 @@
- +
@@ -41,17 +41,25 @@
- +
- + +
+
+
+ +
+
- } @@ -96,13 +104,14 @@ @code { private string _passwordrequirements; - private string username = string.Empty; + private string _username = string.Empty; private string _password = string.Empty; private string _passwordtype = "password"; private string _togglepassword = string.Empty; - private string confirm = string.Empty; - private string email = string.Empty; - private string displayname = string.Empty; + private string _confirm = string.Empty; + private string _email = string.Empty; + private string _displayname = string.Empty; + private string _notify = "True"; private List profiles; private Dictionary settings; private string category = string.Empty; @@ -139,17 +148,18 @@ { try { - if (username != string.Empty && _password != string.Empty && confirm != string.Empty && email != string.Empty && ValidateProfiles()) + if (_username != string.Empty && _password != string.Empty && _confirm != string.Empty && _email != string.Empty && ValidateProfiles()) { - if (_password == confirm) + if (_password == _confirm) { var user = new User(); user.SiteId = PageState.Site.SiteId; - user.Username = username; + user.Username = _username; user.Password = _password; - user.Email = email; - user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname; + user.Email = _email; + user.DisplayName = string.IsNullOrWhiteSpace(_displayname) ? _username : _displayname; user.PhotoFileId = null; + user.SuppressNotification = !bool.Parse(_notify); user = await UserService.AddUserAsync(user); @@ -161,7 +171,7 @@ } else { - await logger.LogError("Error Adding User {Username} {Email}", username, email); + await logger.LogError("Error Adding User {Username} {Email}", _username, _email); AddModuleMessage(Localizer["Error.User.AddCheckPass"], MessageType.Error); } } @@ -177,7 +187,7 @@ } catch (Exception ex) { - await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", username, email, ex.Message); + await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", _username, _email, ex.Message); AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error); } } diff --git a/Oqtane.Client/Modules/Admin/Users/Users.razor b/Oqtane.Client/Modules/Admin/Users/Users.razor index cc7c6d93..a3ac65d3 100644 --- a/Oqtane.Client/Modules/Admin/Users/Users.razor +++ b/Oqtane.Client/Modules/Admin/Users/Users.razor @@ -12,6 +12,15 @@ +
+ +
+ +
+

  @@ -25,6 +34,8 @@ public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin; + private string _notify = "True"; + private async Task ImportUsers() { try @@ -33,10 +44,10 @@ if (fileid != -1) { ShowProgressIndicator(); - var results = await UserService.ImportUsersAsync(PageState.Site.SiteId, fileid); + var results = await UserService.ImportUsersAsync(PageState.Site.SiteId, fileid, bool.Parse(_notify)); if (bool.Parse(results["Success"])) { - AddModuleMessage(string.Format(Localizer["Message.Import.Success"], results["Rows"], results["Users"]), MessageType.Success); + AddModuleMessage(string.Format(Localizer["Message.Import.Success"], results["Users"]), MessageType.Success); } else { diff --git a/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx b/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx index 8ce03a9a..1ad645d9 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx @@ -171,4 +171,10 @@ Password + + Indicate if new users should receive an email notification + + + Notify? + \ No newline at end of file diff --git a/Oqtane.Client/Resources/Modules/Admin/Users/Users.resx b/Oqtane.Client/Resources/Modules/Admin/Users/Users.resx index 86c51ccc..02e73f23 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Users/Users.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Users/Users.resx @@ -1,4 +1,4 @@ - +