remove unused method

This commit is contained in:
sbwalker 2025-01-17 12:50:26 -05:00
parent 677f68b08d
commit 06ca382bd7
4 changed files with 8 additions and 30 deletions

View File

@ -71,14 +71,14 @@
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="username" HelpText="Provide a username for the primary user account" ResourceKey="Username">Username:</Label> <Label Class="col-sm-3" For="username" HelpText="Provide a username for the primary user account" ResourceKey="Username">Username:</Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="username" type="text" class="form-control" @bind="@_hostUsername" /> <input id="username" type="text" class="form-control" maxlength="256" @bind="@_hostUsername" />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="password" HelpText="Provide a password for the primary user account" ResourceKey="Password">Password:</Label> <Label Class="col-sm-3" For="password" HelpText="Provide a password for the primary user account" ResourceKey="Password">Password:</Label>
<div class="col-sm-9"> <div class="col-sm-9">
<div class="input-group"> <div class="input-group">
<input id="password" type="@_passwordType" class="form-control" @bind="@_hostPassword" autocomplete="new-password" /> <input id="password" type="@_passwordType" class="form-control" maxlength="256" @bind="@_hostPassword" autocomplete="new-password" />
<button type="button" class="btn btn-secondary" @onclick="@TogglePassword" tabindex="-1">@_togglePassword</button> <button type="button" class="btn btn-secondary" @onclick="@TogglePassword" tabindex="-1">@_togglePassword</button>
</div> </div>
</div> </div>
@ -87,7 +87,7 @@
<Label Class="col-sm-3" For="confirm" HelpText="Please confirm the password entered above by entering it again" ResourceKey="Confirm">Confirm:</Label> <Label Class="col-sm-3" For="confirm" HelpText="Please confirm the password entered above by entering it again" ResourceKey="Confirm">Confirm:</Label>
<div class="col-sm-9"> <div class="col-sm-9">
<div class="input-group"> <div class="input-group">
<input id="confirm" type="@_confirmPasswordType" class="form-control" @bind="@_confirmPassword" autocomplete="new-password" /> <input id="confirm" type="@_confirmPasswordType" class="form-control" maxlength="256" @bind="@_confirmPassword" autocomplete="new-password" />
<button type="button" class="btn btn-secondary" @onclick="@ToggleConfirmPassword" tabindex="-1">@_toggleConfirmPassword</button> <button type="button" class="btn btn-secondary" @onclick="@ToggleConfirmPassword" tabindex="-1">@_toggleConfirmPassword</button>
</div> </div>
</div> </div>
@ -95,13 +95,13 @@
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="email" HelpText="Provide the email address for the host user account" ResourceKey="Email">Email:</Label> <Label Class="col-sm-3" For="email" HelpText="Provide the email address for the host user account" ResourceKey="Email">Email:</Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" @bind="@_hostEmail" /> <input type="text" class="form-control" maxlength="256" @bind="@_hostEmail" />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="name" HelpText="Provide the full name of the host user" ResourceKey="Name">Full Name:</Label> <Label Class="col-sm-3" For="name" HelpText="Provide the full name of the host user" ResourceKey="Name">Full Name:</Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" @bind="@_hostName" /> <input type="text" class="form-control" maxlength="50" @bind="@_hostName" />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">

View File

@ -56,10 +56,5 @@ namespace Oqtane.Services
{ {
await PostAsync($"{ApiUrl}/restart"); await PostAsync($"{ApiUrl}/restart");
} }
public async Task RegisterAsync(string email, string name)
{
await PostJsonAsync($"{ApiUrl}/register?email={WebUtility.UrlEncode(email)}&name={WebUtility.UrlEncode(name)}", true);
}
} }
} }

View File

@ -34,14 +34,5 @@ namespace Oqtane.Services
/// </summary> /// </summary>
/// <returns>internal status/message object</returns> /// <returns>internal status/message object</returns>
Task RestartAsync(); Task RestartAsync();
/// <summary>
/// Registers a new <see cref="User"/>
/// </summary>
/// <param name="email">Email of the user to be registered</param>
/// <param name="name">Name of the user to be registered</param>
/// <returns></returns>
Task RegisterAsync(string email, string name);
} }
} }

View File

@ -62,7 +62,7 @@ namespace Oqtane.Controllers
if (installation.Success) if (installation.Success)
{ {
await RegisterContact(config.HostEmail, config.HostName); await RegisterContact(config.HostEmail, config.HostName, config.Register);
} }
} }
else else
@ -257,7 +257,7 @@ namespace Oqtane.Controllers
} }
} }
private async Task RegisterContact(string email, string name) private async Task RegisterContact(string email, string name, bool register)
{ {
try try
{ {
@ -268,7 +268,7 @@ namespace Oqtane.Controllers
{ {
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value); client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value);
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(Constants.PackageId, Constants.Version)); client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(Constants.PackageId, Constants.Version));
var response = await client.GetAsync(new Uri(url + $"/api/registry/contact/?id={_configManager.GetInstallationId()}&email={WebUtility.UrlEncode(email)}&name={WebUtility.UrlEncode(name)}")).ConfigureAwait(false); var response = await client.GetAsync(new Uri(url + $"/api/registry/contact/?id={_configManager.GetInstallationId()}&email={WebUtility.UrlEncode(email)}&name={WebUtility.UrlEncode(name)}&register={register.ToString().ToLower()}")).ConfigureAwait(false);
} }
} }
} }
@ -278,14 +278,6 @@ namespace Oqtane.Controllers
} }
} }
// GET api/<controller>/register?email=x&name=y
[HttpPost("register")]
[Authorize(Roles = RoleNames.Host)]
public async Task Register(string email, string name)
{
await RegisterContact(email, name);
}
public struct ClientAssembly public struct ClientAssembly
{ {
public ClientAssembly(string filepath, bool hashfilename) public ClientAssembly(string filepath, bool hashfilename)