@@ -354,6 +363,7 @@
private string _togglesmtppassword = string.Empty;
private string _smtpsender = string.Empty;
private string _smtprelay = "False";
+ private string _smtpenabled = "True";
private string _retention = string.Empty;
private string _pwaisenabled;
private int _pwaappiconfileid = -1;
@@ -434,6 +444,7 @@
_togglesmtppassword = SharedLocalizer["ShowPassword"];
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
_smtprelay = SettingService.GetSetting(settings, "SMTPRelay", "False");
+ _smtpenabled = SettingService.GetSetting(settings, "SMTPEnabled", "True");
_retention = SettingService.GetSetting(settings, "NotificationRetention", "30");
// aliases
@@ -600,7 +611,8 @@
settings = SettingService.SetSetting(settings, "SMTPPassword", _smtppassword, true);
settings = SettingService.SetSetting(settings, "SMTPSender", _smtpsender, true);
settings = SettingService.SetSetting(settings, "SMTPRelay", _smtprelay, true);
- settings = SettingService.SetSetting(settings, "NotificationRetention", _retention, true);
+ settings = SettingService.SetSetting(settings, "SMTPEnabled", _smtpenabled, true);
+ settings = SettingService.SetSetting(settings, "NotificationRetention", _retention, true);
await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId);
await logger.LogInformation("Site Settings Saved {Site}", site);
@@ -612,8 +624,8 @@
else
{
AddModuleMessage(Localizer["Success.Settings.SaveSite"], MessageType.Success);
- await interop.ScrollTo(0, 0, "smooth");
- }
+ await ScrollToPageTop();
+ }
}
}
else
@@ -681,9 +693,8 @@
await NotificationService.AddNotificationAsync(new Notification(PageState.Site.SiteId, PageState.User, PageState.Site.Name + " SMTP Configuration Test", "SMTP Server Is Configured Correctly."));
AddModuleMessage(Localizer["Info.Smtp.SaveSettings"], MessageType.Info);
- var interop = new Interop(JSRuntime);
- await interop.ScrollTo(0, 0, "smooth");
- }
+ await ScrollToPageTop();
+ }
catch (Exception ex)
{
await logger.LogError(ex, "Error Testing SMTP Configuration");
diff --git a/Oqtane.Client/Modules/Admin/Themes/Edit.razor b/Oqtane.Client/Modules/Admin/Themes/Edit.razor
index 03bb6cf1..00e22f29 100644
--- a/Oqtane.Client/Modules/Admin/Themes/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/Edit.razor
@@ -13,7 +13,7 @@
@@ -89,32 +89,32 @@
private string _themeName = "";
private string _isenabled;
private string _name;
- private string _version;
- private string _packagename;
- private string _owner = "";
- private string _url = "";
- private string _contact = "";
- private string _license = "";
+ private string _version;
+ private string _packagename;
+ private string _owner = "";
+ private string _url = "";
+ private string _contact = "";
+ private string _license = "";
private string _createdby;
private DateTime _createdon;
private string _modifiedby;
private DateTime _modifiedon;
- public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
+ public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
- protected override async Task OnInitializedAsync()
- {
- try
- {
+ protected override async Task OnInitializedAsync()
+ {
+ try
+ {
_themeId = Int32.Parse(PageState.QueryString["id"]);
var theme = await ThemeService.GetThemeAsync(_themeId, ModuleState.SiteId);
- if (theme != null)
- {
- _name = theme.Name;
+ if (theme != null)
+ {
+ _name = theme.Name;
_isenabled =theme.IsEnabled.ToString();
_version = theme.Version;
- _packagename = theme.PackageName;
- _owner = theme.Owner;
+ _packagename = theme.PackageName;
+ _owner = theme.Owner;
_url = theme.Url;
_contact = theme.Contact;
_license = theme.License;
@@ -142,6 +142,7 @@
try
{
var theme = await ThemeService.GetThemeAsync(_themeId, ModuleState.SiteId);
+ theme.Name = _name;
theme.IsEnabled = (_isenabled == null ? true : bool.Parse(_isenabled));
await ThemeService.UpdateThemeAsync(theme);
await logger.LogInformation("Theme Saved {Theme}", theme);
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
index 70aa3487..e1eabc2c 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
@@ -1,4 +1,5 @@
@namespace Oqtane.Modules.Admin.UserProfile
+@using System.Text.RegularExpressions;
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IUserService UserService
@@ -227,140 +228,140 @@ else
@code {
- 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 bool allowtwofactor = false;
- private string twofactor = "False";
- private string email = string.Empty;
- private string displayname = string.Empty;
- private FileManager filemanager;
- private int folderid = -1;
- private int photofileid = -1;
- private File photo = null;
- private List
profiles;
- private Dictionary settings;
- private string category = string.Empty;
- private string filter = "to";
- private List notifications;
+ 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 bool allowtwofactor = false;
+ private string twofactor = "False";
+ private string email = string.Empty;
+ private string displayname = string.Empty;
+ private FileManager filemanager;
+ private int folderid = -1;
+ private int photofileid = -1;
+ private File photo = null;
+ private List profiles;
+ private Dictionary settings;
+ private string category = string.Empty;
+ private string filter = "to";
+ private List notifications;
- public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
+ public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
- protected override async Task OnParametersSetAsync()
- {
- try
- {
- _togglepassword = SharedLocalizer["ShowPassword"];
+ protected override async Task OnParametersSetAsync()
+ {
+ try
+ {
+ _togglepassword = SharedLocalizer["ShowPassword"];
- if (PageState.Site.Settings.ContainsKey("LoginOptions:TwoFactor") && !string.IsNullOrEmpty(PageState.Site.Settings["LoginOptions:TwoFactor"]))
- {
- allowtwofactor = (PageState.Site.Settings["LoginOptions:TwoFactor"] == "true");
- }
+ if (PageState.Site.Settings.ContainsKey("LoginOptions:TwoFactor") && !string.IsNullOrEmpty(PageState.Site.Settings["LoginOptions:TwoFactor"]))
+ {
+ allowtwofactor = (PageState.Site.Settings["LoginOptions:TwoFactor"] == "true");
+ }
- if (PageState.User != null)
- {
- username = PageState.User.Username;
- twofactor = PageState.User.TwoFactorRequired.ToString();
- email = PageState.User.Email;
- displayname = PageState.User.DisplayName;
+ if (PageState.User != null)
+ {
+ username = PageState.User.Username;
+ twofactor = PageState.User.TwoFactorRequired.ToString();
+ email = PageState.User.Email;
+ displayname = PageState.User.DisplayName;
- // get user folder
- var folder = await FolderService.GetFolderAsync(ModuleState.SiteId, PageState.User.FolderPath);
- if (folder != null)
- {
- folderid = folder.FolderId;
- }
+ // get user folder
+ var folder = await FolderService.GetFolderAsync(ModuleState.SiteId, PageState.User.FolderPath);
+ if (folder != null)
+ {
+ folderid = folder.FolderId;
+ }
- if (PageState.User.PhotoFileId != null)
- {
- photofileid = PageState.User.PhotoFileId.Value;
- photo = await FileService.GetFileAsync(photofileid);
- }
- else
- {
- photofileid = -1;
- photo = null;
- }
+ if (PageState.User.PhotoFileId != null)
+ {
+ photofileid = PageState.User.PhotoFileId.Value;
+ photo = await FileService.GetFileAsync(photofileid);
+ }
+ else
+ {
+ photofileid = -1;
+ photo = null;
+ }
- profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
- settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
+ profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
+ settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
- await LoadNotificationsAsync();
- }
- else
- {
- AddModuleMessage(Localizer["Message.User.NoLogIn"], MessageType.Warning);
- }
- }
- catch (Exception ex)
- {
- await logger.LogError(ex, "Error Loading User Profile {Error}", ex.Message);
- AddModuleMessage(Localizer["Error.Profile.Load"], MessageType.Error);
- }
- }
+ await LoadNotificationsAsync();
+ }
+ else
+ {
+ AddModuleMessage(Localizer["Message.User.NoLogIn"], MessageType.Warning);
+ }
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Loading User Profile {Error}", ex.Message);
+ AddModuleMessage(Localizer["Error.Profile.Load"], MessageType.Error);
+ }
+ }
- private async Task LoadNotificationsAsync()
- {
- notifications = await NotificationService.GetNotificationsAsync(PageState.Site.SiteId, filter, PageState.User.UserId);
- notifications = notifications.Where(item => item.DeletedBy != PageState.User.Username).ToList();
- }
+ private async Task LoadNotificationsAsync()
+ {
+ notifications = await NotificationService.GetNotificationsAsync(PageState.Site.SiteId, filter, PageState.User.UserId);
+ notifications = notifications.Where(item => item.DeletedBy != PageState.User.Username).ToList();
+ }
- private string GetProfileValue(string SettingName, string DefaultValue)
- {
- string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
- if (value.Contains("]"))
- {
- value = value.Substring(value.IndexOf("]") + 1);
- }
- return value;
- }
+ private string GetProfileValue(string SettingName, string DefaultValue)
+ {
+ string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
+ if (value.Contains("]"))
+ {
+ value = value.Substring(value.IndexOf("]") + 1);
+ }
+ return value;
+ }
- private async Task Save()
- {
- try
- {
- if (username != string.Empty && email != string.Empty && ValidateProfiles())
- {
- if (_password == confirm)
- {
- var user = PageState.User;
- user.Username = username;
- user.Password = _password;
- user.TwoFactorRequired = bool.Parse(twofactor);
- user.Email = email;
- user.DisplayName = (displayname == string.Empty ? username : displayname);
- user.PhotoFileId = filemanager.GetFileId();
- if (user.PhotoFileId == -1)
- {
- user.PhotoFileId = null;
- }
- if (user.PhotoFileId != null)
- {
- photofileid = user.PhotoFileId.Value;
- photo = await FileService.GetFileAsync(photofileid);
- }
- else
- {
- photofileid = -1;
- photo = null;
- }
+ private async Task Save()
+ {
+ try
+ {
+ if (username != string.Empty && email != string.Empty && ValidateProfiles())
+ {
+ if (_password == confirm)
+ {
+ var user = PageState.User;
+ user.Username = username;
+ user.Password = _password;
+ user.TwoFactorRequired = bool.Parse(twofactor);
+ user.Email = email;
+ user.DisplayName = (displayname == string.Empty ? username : displayname);
+ user.PhotoFileId = filemanager.GetFileId();
+ if (user.PhotoFileId == -1)
+ {
+ user.PhotoFileId = null;
+ }
+ if (user.PhotoFileId != null)
+ {
+ photofileid = user.PhotoFileId.Value;
+ photo = await FileService.GetFileAsync(photofileid);
+ }
+ else
+ {
+ photofileid = -1;
+ photo = null;
+ }
- user = await UserService.UpdateUserAsync(user);
- if (user != null)
- {
- await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
- await logger.LogInformation("User Profile Saved");
+ user = await UserService.UpdateUserAsync(user);
+ if (user != null)
+ {
+ await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
+ await logger.LogInformation("User Profile Saved");
- AddModuleMessage(Localizer["Success.Profile.Update"], MessageType.Success);
- StateHasChanged();
- }
- else
- {
- AddModuleMessage(Localizer["Message.Password.Complexity"], MessageType.Error);
- }
- }
+ AddModuleMessage(Localizer["Success.Profile.Update"], MessageType.Success);
+ StateHasChanged();
+ }
+ else
+ {
+ AddModuleMessage(Localizer["Message.Password.Complexity"], MessageType.Error);
+ }
+ }
else
{
AddModuleMessage(Localizer["Message.Password.Invalid"], MessageType.Warning);
@@ -370,6 +371,8 @@ else
{
AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
}
+
+ await ScrollToPageTop();
}
catch (Exception ex)
{
@@ -389,10 +392,15 @@ else
}
if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{
- if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
+ if (valid == true && profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
{
valid = false;
}
+ if (valid == true && !string.IsNullOrEmpty(profile.Validation))
+ {
+ Regex regex = new Regex(profile.Validation);
+ valid = regex.Match(SettingService.GetSetting(settings, profile.Name, string.Empty)).Success;
+ }
}
}
return valid;
diff --git a/Oqtane.Client/Modules/Admin/Users/Add.razor b/Oqtane.Client/Modules/Admin/Users/Add.razor
index 713dab6e..54c396ee 100644
--- a/Oqtane.Client/Modules/Admin/Users/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Add.razor
@@ -1,4 +1,5 @@
@namespace Oqtane.Modules.Admin.Users
+@using System.Text.RegularExpressions;
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IUserService UserService
@@ -95,8 +96,8 @@
@code {
private string username = string.Empty;
private string _password = string.Empty;
- private string _passwordtype = "password";
- private string _togglepassword = 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;
@@ -121,15 +122,15 @@
}
}
- private string GetProfileValue(string SettingName, string DefaultValue)
- {
- string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
- if (value.Contains("]"))
- {
- value = value.Substring(value.IndexOf("]") + 1);
- }
- return value;
- }
+ private string GetProfileValue(string SettingName, string DefaultValue)
+ {
+ string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
+ if (value.Contains("]"))
+ {
+ value = value.Substring(value.IndexOf("]") + 1);
+ }
+ return value;
+ }
private async Task SaveUser()
{
@@ -195,9 +196,17 @@
{
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
}
- if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
+ if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{
- valid = false;
+ if (valid == true && profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
+ {
+ valid = false;
+ }
+ if (valid == true && !string.IsNullOrEmpty(profile.Validation))
+ {
+ Regex regex = new Regex(profile.Validation);
+ valid = regex.Match(SettingService.GetSetting(settings, profile.Name, string.Empty)).Success;
+ }
}
}
return valid;
diff --git a/Oqtane.Client/Modules/Admin/Users/Edit.razor b/Oqtane.Client/Modules/Admin/Users/Edit.razor
index af541617..fea1a6f0 100644
--- a/Oqtane.Client/Modules/Admin/Users/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Edit.razor
@@ -1,4 +1,5 @@
@namespace Oqtane.Modules.Admin.Users
+@using System.Text.RegularExpressions;
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IUserService UserService
@@ -148,124 +149,124 @@ else
@code {
- private int userid;
- 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 FileManager filemanager;
- private int photofileid = -1;
- private File photo = null;
- private string isdeleted;
- private string lastlogin;
- private string lastipaddress;
+ private int userid;
+ 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 FileManager filemanager;
+ private int photofileid = -1;
+ private File photo = null;
+ private string isdeleted;
+ private string lastlogin;
+ private string lastipaddress;
- private List profiles;
- private Dictionary settings;
- private string category = string.Empty;
+ private List profiles;
+ private Dictionary settings;
+ private string category = string.Empty;
- private string createdby;
- private DateTime createdon;
- private string modifiedby;
- private DateTime modifiedon;
- private string deletedby;
- private DateTime? deletedon;
+ private string createdby;
+ private DateTime createdon;
+ private string modifiedby;
+ private DateTime modifiedon;
+ private string deletedby;
+ private DateTime? deletedon;
- public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
+ public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
- protected override async Task OnParametersSetAsync()
- {
- try
- {
- if (PageState.QueryString.ContainsKey("id"))
- {
- _togglepassword = SharedLocalizer["ShowPassword"];
- profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
- userid = Int32.Parse(PageState.QueryString["id"]);
- var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
- if (user != null)
- {
- username = user.Username;
- email = user.Email;
- displayname = user.DisplayName;
- if (user.PhotoFileId != null)
- {
- photofileid = user.PhotoFileId.Value;
- photo = await FileService.GetFileAsync(photofileid);
- }
- else
- {
- photofileid = -1;
- photo = null;
- }
- isdeleted = user.IsDeleted.ToString();
- lastlogin = string.Format("{0:MMM dd yyyy HH:mm:ss}", user.LastLoginOn);
- lastipaddress = user.LastIPAddress;
+ protected override async Task OnParametersSetAsync()
+ {
+ try
+ {
+ if (PageState.QueryString.ContainsKey("id"))
+ {
+ _togglepassword = SharedLocalizer["ShowPassword"];
+ profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
+ userid = Int32.Parse(PageState.QueryString["id"]);
+ var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
+ if (user != null)
+ {
+ username = user.Username;
+ email = user.Email;
+ displayname = user.DisplayName;
+ if (user.PhotoFileId != null)
+ {
+ photofileid = user.PhotoFileId.Value;
+ photo = await FileService.GetFileAsync(photofileid);
+ }
+ else
+ {
+ photofileid = -1;
+ photo = null;
+ }
+ 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);
- }
- }
+ 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);
+ }
+ }
- private string GetProfileValue(string SettingName, string DefaultValue)
- {
- string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
- if (value.Contains("]"))
- {
- value = value.Substring(value.IndexOf("]") + 1);
- }
- return value;
- }
+ private string GetProfileValue(string SettingName, string DefaultValue)
+ {
+ string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
+ if (value.Contains("]"))
+ {
+ value = value.Substring(value.IndexOf("]") + 1);
+ }
+ return value;
+ }
- 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);
- 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);
- }
+ 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
{
@@ -293,9 +294,17 @@ else
{
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
}
- if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
+ if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{
- valid = false;
+ if (valid == true && profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
+ {
+ valid = false;
+ }
+ if (valid == true && !string.IsNullOrEmpty(profile.Validation))
+ {
+ Regex regex = new Regex(profile.Validation);
+ valid = regex.Match(SettingService.GetSetting(settings, profile.Name, string.Empty)).Success;
+ }
}
}
return valid;
diff --git a/Oqtane.Client/Modules/HtmlText/Edit.razor b/Oqtane.Client/Modules/HtmlText/Edit.razor
index bb609f80..72a9662c 100644
--- a/Oqtane.Client/Modules/HtmlText/Edit.razor
+++ b/Oqtane.Client/Modules/HtmlText/Edit.razor
@@ -53,7 +53,6 @@
public override List Resources => new List()
{
- new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill.bubble.css" },
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill.snow.css" }
};
diff --git a/Oqtane.Client/Modules/HtmlText/Index.razor b/Oqtane.Client/Modules/HtmlText/Index.razor
index 4428d033..77f7b95d 100644
--- a/Oqtane.Client/Modules/HtmlText/Index.razor
+++ b/Oqtane.Client/Modules/HtmlText/Index.razor
@@ -15,11 +15,6 @@
}
@code {
- public override List Resources => new List()
- {
- new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
- };
-
private string content = "";
protected override async Task OnParametersSetAsync()
diff --git a/Oqtane.Client/Modules/HtmlText/ModuleInfo.cs b/Oqtane.Client/Modules/HtmlText/ModuleInfo.cs
index 36e674fe..59a473c4 100644
--- a/Oqtane.Client/Modules/HtmlText/ModuleInfo.cs
+++ b/Oqtane.Client/Modules/HtmlText/ModuleInfo.cs
@@ -1,5 +1,7 @@
+using System.Collections.Generic;
using Oqtane.Documentation;
using Oqtane.Models;
+using Oqtane.Shared;
namespace Oqtane.Modules.HtmlText
{
@@ -13,7 +15,11 @@ namespace Oqtane.Modules.HtmlText
Version = "1.0.1",
ServerManagerType = "Oqtane.Modules.HtmlText.Manager.HtmlTextManager, Oqtane.Server",
ReleaseVersions = "1.0.0,1.0.1",
- SettingsType = "Oqtane.Modules.HtmlText.Settings, Oqtane.Client"
+ SettingsType = "Oqtane.Modules.HtmlText.Settings, Oqtane.Client",
+ Resources = new List()
+ {
+ new Resource { ResourceType = ResourceType.Stylesheet, Url = "~/Module.css" }
+ }
};
}
}
diff --git a/Oqtane.Client/Modules/ModuleBase.cs b/Oqtane.Client/Modules/ModuleBase.cs
index 01ad8848..8aceca83 100644
--- a/Oqtane.Client/Modules/ModuleBase.cs
+++ b/Oqtane.Client/Modules/ModuleBase.cs
@@ -291,6 +291,12 @@ namespace Oqtane.Modules
}
}
+ public async Task ScrollToPageTop()
+ {
+ var interop = new Interop(JSRuntime);
+ await interop.ScrollTo(0, 0, "smooth");
+ }
+
// logging methods
public async Task Log(Alias alias, LogLevel level, string function, Exception exception, string message, params object[] args)
{
diff --git a/Oqtane.Client/Resources/Modules/Admin/Profiles/Edit.resx b/Oqtane.Client/Resources/Modules/Admin/Profiles/Edit.resx
index 720e34f9..8a3a23ca 100644
--- a/Oqtane.Client/Resources/Modules/Admin/Profiles/Edit.resx
+++ b/Oqtane.Client/Resources/Modules/Admin/Profiles/Edit.resx
@@ -183,4 +183,10 @@
Private?
+
+ Optionally provide a regular expression (RegExp) for validating the value entered
+
+
+ Validation:
+
\ No newline at end of file
diff --git a/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx b/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx
index 5abaf9f2..0f9d634e 100644
--- a/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx
+++ b/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx
@@ -369,4 +369,10 @@
Page Content
+
+ Specify if SMTP is enabled for this site
+
+
+ Enabled?
+
\ No newline at end of file
diff --git a/Oqtane.Client/Themes/Controls/Theme/ControlPanel.razor b/Oqtane.Client/Themes/Controls/Theme/ControlPanel.razor
index b37c6905..de4d7957 100644
--- a/Oqtane.Client/Themes/Controls/Theme/ControlPanel.razor
+++ b/Oqtane.Client/Themes/Controls/Theme/ControlPanel.razor
@@ -1,3 +1,4 @@
+@using System.Net
@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@inject NavigationManager NavigationManager
@@ -501,7 +502,7 @@
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.AdminDashboardModule);
if (module != null)
{
- NavigationManager.NavigateTo(EditUrl(PageState.Page.Path, module.ModuleId, "Index", ""));
+ NavigationManager.NavigateTo(EditUrl("admin", module.ModuleId, "Index", "returnurl=" + WebUtility.UrlEncode(PageState.Route.PathAndQuery)));
}
break;
case "Add":
diff --git a/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs b/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs
index 763c694c..e6105970 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs
+++ b/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs
@@ -1,5 +1,7 @@
+using System.Collections.Generic;
using Oqtane.Documentation;
using Oqtane.Models;
+using Oqtane.Shared;
namespace Oqtane.Themes.OqtaneTheme
{
@@ -11,7 +13,13 @@ namespace Oqtane.Themes.OqtaneTheme
Name = "Oqtane Theme",
Version = "1.0.0",
ThemeSettingsType = "Oqtane.Themes.OqtaneTheme.ThemeSettings, Oqtane.Client",
- ContainerSettingsType = "Oqtane.Themes.OqtaneTheme.ContainerSettings, Oqtane.Client"
+ ContainerSettingsType = "Oqtane.Themes.OqtaneTheme.ContainerSettings, Oqtane.Client",
+ Resources = new List()
+ {
+ new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.2.0/cyborg/bootstrap.min.css", Integrity = "sha512-d6pZJl/sNcj0GFkp4kTjXtPE14deuUsOqFQtxkj0KyBJQl+4e0qsEyuIDcNqrYuGoauAW3sWyDCQp49mhF4Syw==", CrossOrigin = "anonymous" },
+ new Resource { ResourceType = ResourceType.Stylesheet, Url = "~/Theme.css" },
+ new Resource { ResourceType = ResourceType.Script, Url = "https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.bundle.min.js", Integrity = "sha512-9GacT4119eY3AcosfWtHMsT5JyZudrexyEVzTBWV3viP/YfB9e2pEy3N7WXL3SV6ASXpTU0vzzSxsbfsuUH4sQ==", CrossOrigin = "anonymous" }
+ }
};
}
}
diff --git a/Oqtane.Client/Themes/OqtaneTheme/Themes/Default.razor b/Oqtane.Client/Themes/OqtaneTheme/Themes/Default.razor
index fe88310c..e4ba70f7 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/Themes/Default.razor
+++ b/Oqtane.Client/Themes/OqtaneTheme/Themes/Default.razor
@@ -110,14 +110,6 @@
public override string Panes => PaneNames.Default + ",Top Full Width,Top 100%,Left 50%,Right 50%,Left 33%,Center 33%,Right 33%,Left Outer 25%,Left Inner 25%,Right Inner 25%,Right Outer 25%,Left 25%,Center 50%,Right 25%,Left Sidebar 66%,Right Sidebar 33%,Left Sidebar 33%,Right Sidebar 66%,Bottom 100%,Bottom Full Width,Footer";
- public override List Resources => new List()
- {
- // obtained from https://cdnjs.com/libraries
- new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.2.0/cyborg/bootstrap.min.css", Integrity = "sha512-d6pZJl/sNcj0GFkp4kTjXtPE14deuUsOqFQtxkj0KyBJQl+4e0qsEyuIDcNqrYuGoauAW3sWyDCQp49mhF4Syw==", CrossOrigin = "anonymous" },
- new Resource { ResourceType = ResourceType.Stylesheet, Url = ThemePath() + "Theme.css" },
- new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.bundle.min.js", Integrity = "sha512-9GacT4119eY3AcosfWtHMsT5JyZudrexyEVzTBWV3viP/YfB9e2pEy3N7WXL3SV6ASXpTU0vzzSxsbfsuUH4sQ==", CrossOrigin = "anonymous" }
- };
-
private bool _login = true;
private bool _register = true;
private bool _footer = false;
diff --git a/Oqtane.Client/UI/SiteRouter.razor b/Oqtane.Client/UI/SiteRouter.razor
index 8465faa8..d2ef90a4 100644
--- a/Oqtane.Client/UI/SiteRouter.razor
+++ b/Oqtane.Client/UI/SiteRouter.razor
@@ -531,10 +531,13 @@
{
foreach (var resource in resources)
{
- if (!resource.Url.Contains("://") && resource.Url.StartsWith("~/"))
+ if (resource.Url.StartsWith("~"))
{
- // create local path
- resource.Url = resource.Url.Replace("~", alias.BaseUrl + "/" + type + "/" + name);
+ resource.Url = resource.Url.Replace("~", "/" + type + "/" + name + "/").Replace("//", "/");
+ }
+ if (!resource.Url.Contains("://") && alias.BaseUrl != "" && !resource.Url.StartsWith(alias.BaseUrl))
+ {
+ resource.Url = alias.BaseUrl + resource.Url;
}
// ensure resource does not exist already
diff --git a/Oqtane.Client/UI/ThemeBuilder.razor b/Oqtane.Client/UI/ThemeBuilder.razor
index 157a4999..2b185b83 100644
--- a/Oqtane.Client/UI/ThemeBuilder.razor
+++ b/Oqtane.Client/UI/ThemeBuilder.razor
@@ -96,6 +96,30 @@
{
await InjectScripts(PageState.Page.BodyContent, ResourceLocation.Body);
}
+
+ if (PageState.Page.Resources != null && PageState.Page.Resources.Exists(item => item.ResourceType == ResourceType.Script))
+ {
+ var interop = new Interop(JSRuntime);
+ var scripts = new List