commit
fe2ad29b3b
|
@ -8,7 +8,7 @@
|
|||
<ModuleMessage Message="@_message" Type="MessageType.Info" />
|
||||
}
|
||||
|
||||
<div class="container">
|
||||
<div class="container @_css">
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username: </label>
|
||||
<input type="text" class="form-control" placeholder="Username" @bind="@_username" id="Username"/>
|
||||
|
@ -40,9 +40,22 @@
|
|||
private string _confirm = string.Empty;
|
||||
private string _email = string.Empty;
|
||||
private string _displayName = string.Empty;
|
||||
private string _css = string.Empty;
|
||||
private const string displayNone = "d-none";
|
||||
|
||||
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Anonymous;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (!PageState.Site.AllowRegistration)
|
||||
{
|
||||
_message = "Registration is Disabled";
|
||||
_css = displayNone;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Register()
|
||||
{
|
||||
try
|
||||
|
|
|
@ -11,12 +11,14 @@ namespace Oqtane.Services
|
|||
private readonly HttpClient _http;
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly ISiteService _siteService;
|
||||
|
||||
public UserService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
||||
public UserService(HttpClient http, SiteState siteState, NavigationManager navigationManager, ISiteService siteService)
|
||||
{
|
||||
_http = http;
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
_siteService = siteService;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
|
@ -36,6 +38,13 @@ namespace Oqtane.Services
|
|||
|
||||
public async Task<User> AddUserAsync(User user)
|
||||
{
|
||||
Site site = await _siteService.GetSiteAsync(_siteState.Alias.SiteId, _siteState.Alias);
|
||||
|
||||
if (!site.AllowRegistration)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return await _http.PostJsonAsync<User>(Apiurl, user);
|
||||
|
|
Loading…
Reference in New Issue
Block a user