Improved page reload efficiency, refactored NavigateUrl and EditUrl helpers, added antiforgery token and returnurl to Logout scenario, fixed PageModule service call api url, modified rendering engine to allow for component differentiation
This commit is contained in:
@ -73,7 +73,8 @@ private async Task Login()
|
||||
{
|
||||
// client-side Blazor
|
||||
authstateprovider.NotifyAuthenticationChanged();
|
||||
UriHelper.NavigateTo(NavigateUrl(ReturnUrl, true));
|
||||
PageState.Reload = Constants.ReloadPage;
|
||||
UriHelper.NavigateTo(NavigateUrl(ReturnUrl));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -85,6 +86,6 @@ private async Task Login()
|
||||
private void Cancel()
|
||||
{
|
||||
string ReturnUrl = PageState.QueryString["returnurl"];
|
||||
UriHelper.NavigateTo(NavigateUrl(ReturnUrl));
|
||||
UriHelper.NavigateTo(ReturnUrl);
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,7 @@
|
||||
pagemodule.ContainerType = containertype;
|
||||
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
||||
|
||||
UriHelper.NavigateTo(NavigateUrl(true));
|
||||
PageState.Reload = Constants.ReloadPage;
|
||||
UriHelper.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +170,7 @@
|
||||
p.ViewPermissions = viewpermissions;
|
||||
p.EditPermissions = editpermissions;
|
||||
await PageService.AddPageAsync(p);
|
||||
UriHelper.NavigateTo(NavigateUrl(path, true));
|
||||
PageState.Reload = Constants.ReloadSite;
|
||||
UriHelper.NavigateTo(NavigateUrl(path));
|
||||
}
|
||||
}
|
||||
|
@ -157,6 +157,7 @@
|
||||
private async Task DeletePage()
|
||||
{
|
||||
await PageService.DeletePageAsync(Int32.Parse(PageState.QueryString["id"]));
|
||||
UriHelper.NavigateTo(NavigateUrl("", true));
|
||||
PageState.Reload = Constants.ReloadSite;
|
||||
UriHelper.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
|
@ -16,24 +16,29 @@
|
||||
<input type="password" name="Password" class="form-control" placeholder="Password" @bind="@Password" />
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @onclick="@RegisterUser">Register</button>
|
||||
<NavLink class="btn btn-secondary" href="/">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-secondary" @onclick="@Cancel">Cancel</button>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Anonymous; } }
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Anonymous; } }
|
||||
|
||||
public string Username { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
public string Username { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
private async Task RegisterUser()
|
||||
{
|
||||
User user = new User();
|
||||
user.Username = Username;
|
||||
user.DisplayName = Username;
|
||||
user.Roles = "Administrators;";
|
||||
user.IsSuperUser = false;
|
||||
user.Password = Password;
|
||||
await UserService.AddUserAsync(user);
|
||||
UriHelper.NavigateTo("");
|
||||
}
|
||||
private async Task RegisterUser()
|
||||
{
|
||||
User user = new User();
|
||||
user.Username = Username;
|
||||
user.DisplayName = Username;
|
||||
user.Roles = "Administrators;";
|
||||
user.IsSuperUser = false;
|
||||
user.Password = Password;
|
||||
await UserService.AddUserAsync(user);
|
||||
UriHelper.NavigateTo("");
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
UriHelper.NavigateTo(NavigateUrl("")); // navigate to home
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@
|
||||
htmltext.Content = content;
|
||||
await htmltextservice.AddHtmlTextAsync(htmltext);
|
||||
}
|
||||
UriHelper.NavigateTo(NavigateUrl(true));
|
||||
PageState.Reload = Constants.ReloadPage;
|
||||
UriHelper.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
|
@ -20,32 +20,37 @@ namespace Oqtane.Modules
|
||||
|
||||
public string NavigateUrl()
|
||||
{
|
||||
return Utilities.NavigateUrl(PageState);
|
||||
}
|
||||
|
||||
public string NavigateUrl(bool reload)
|
||||
{
|
||||
return Utilities.NavigateUrl(PageState, reload);
|
||||
return NavigateUrl(PageState.Page.Path);
|
||||
}
|
||||
|
||||
public string NavigateUrl(string path)
|
||||
{
|
||||
return Utilities.NavigateUrl(PageState, path);
|
||||
}
|
||||
|
||||
public string NavigateUrl(string path, bool reload)
|
||||
{
|
||||
return Utilities.NavigateUrl(PageState, path, reload);
|
||||
return Utilities.NavigateUrl(PageState.Alias.Path, path);
|
||||
}
|
||||
|
||||
public string EditUrl(string action)
|
||||
{
|
||||
return Utilities.EditUrl(PageState, ModuleState, action, "");
|
||||
return EditUrl(ModuleState.ModuleId, action);
|
||||
}
|
||||
|
||||
public string EditUrl(string action, string parameters)
|
||||
{
|
||||
return Utilities.EditUrl(PageState, ModuleState, action, parameters);
|
||||
return EditUrl(ModuleState.ModuleId, action, parameters);
|
||||
}
|
||||
|
||||
public string EditUrl(int moduleid, string action)
|
||||
{
|
||||
return EditUrl(moduleid, action, "");
|
||||
}
|
||||
|
||||
public string EditUrl(int moduleid, string action, string parameters)
|
||||
{
|
||||
return EditUrl(PageState.Page.Path, moduleid, action, parameters);
|
||||
}
|
||||
|
||||
public string EditUrl(string path, int moduleid, string action, string parameters)
|
||||
{
|
||||
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user