-
+
-
+
-
-
+
+
@@ -23,15 +23,15 @@
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
- string Username = "";
- string Password = "";
- string Confirm = "";
+ string _username = "";
+ string _password = "";
+ string _confirm = "";
protected override void OnInitialized()
{
if (PageState.QueryString.ContainsKey("name") && PageState.QueryString.ContainsKey("token"))
{
- Username = PageState.QueryString["name"];
+ _username = PageState.QueryString["name"];
}
else
{
@@ -43,24 +43,26 @@
{
try
{
- if (Username != "" && Password != "" && Confirm != "")
+ if (_username != "" && _password != "" && _confirm != "")
{
- if (Password == Confirm)
+ if (_password == _confirm)
{
- User user = new User();
- user.SiteId = PageState.Site.SiteId;
- user.Username = Username;
- user.Password = Password;
+ User user = new User
+ {
+ SiteId = PageState.Site.SiteId,
+ Username = _username,
+ Password = _password
+ };
user = await UserService.ResetPasswordAsync(user, PageState.QueryString["token"]);
if (user != null)
{
- await logger.LogInformation("User Password Reset {Username}", Username);
+ await logger.LogInformation("User Password Reset {Username}", _username);
NavigationManager.NavigateTo(NavigateUrl("login"));
}
else
{
- await logger.LogError("Error Resetting User Password {Username}", Username);
+ await logger.LogError("Error Resetting User Password {Username}", _username);
AddModuleMessage("Error Resetting User Password. Please Ensure Password Meets Complexity Requirements.", MessageType.Error);
}
}
@@ -76,7 +78,7 @@
}
catch (Exception ex)
{
- await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", Username, ex.Message);
+ await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
AddModuleMessage("Error Resetting User Password", MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
index 8639a737..1b3a7834 100644
--- a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
+++ b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
@@ -1,20 +1,19 @@
using System.Collections.Generic;
using System.Linq;
-using System.Threading.Tasks;
using System.Net.Http;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
-using Oqtane.Services;
using Oqtane.Modules.HtmlText.Models;
+using Oqtane.Services;
using Oqtane.Shared;
-using Oqtane.Models;
namespace Oqtane.Modules.HtmlText.Services
{
public class HtmlTextService : ServiceBase, IHtmlTextService
{
private readonly HttpClient _http;
- private readonly SiteState _siteState;
private readonly NavigationManager _navigationManager;
+ private readonly SiteState _siteState;
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
{
@@ -23,42 +22,39 @@ namespace Oqtane.Modules.HtmlText.Services
_navigationManager = navigationManager;
}
- private string apiurl
- {
- get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText"); }
- }
+ private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText");
- public async Task
GetHtmlTextAsync(int ModuleId)
+ public async Task GetHtmlTextAsync(int moduleId)
{
- HtmlTextInfo htmltext;
+ HtmlTextInfo htmlText;
try
{
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
//null value is transfered as empty list
- var htmltextList = await _http.GetJsonAsync>(apiurl + "/" + ModuleId.ToString() + "?entityid=" + ModuleId.ToString());
- htmltext = htmltextList.FirstOrDefault();
+ var htmlTextList = await _http.GetJsonAsync>(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
+ htmlText = htmlTextList.FirstOrDefault();
}
catch
{
- htmltext = null;
+ htmlText = null;
}
- return htmltext;
+
+ return htmlText;
}
- public async Task AddHtmlTextAsync(HtmlTextInfo htmltext)
+ public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
{
- await _http.PostJsonAsync(apiurl + "?entityid=" + htmltext.ModuleId.ToString(), htmltext);
+ await _http.PostJsonAsync(ApiUrl + "?entityid=" + htmlText.ModuleId, htmlText);
}
- public async Task UpdateHtmlTextAsync(HtmlTextInfo htmltext)
+ public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
{
- await _http.PutJsonAsync(apiurl + "/" + htmltext.HtmlTextId.ToString() + "?entityid=" + htmltext.ModuleId.ToString(), htmltext);
+ await _http.PutJsonAsync(ApiUrl + "/" + htmlText.HtmlTextId + "?entityid=" + htmlText.ModuleId, htmlText);
}
- public async Task DeleteHtmlTextAsync(int ModuleId)
+ public async Task DeleteHtmlTextAsync(int moduleId)
{
- await _http.DeleteAsync(apiurl + "/" + ModuleId.ToString() + "?entityid=" + ModuleId.ToString());
+ await _http.DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
}
-
}
}