allow entry of name during installation
This commit is contained in:
		| @ -98,6 +98,12 @@ | ||||
|                         <input type="text" class="form-control" @bind="@_hostEmail" /> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <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> | ||||
|                     <div class="col-sm-9"> | ||||
|                         <input type="text" class="form-control" @bind="@_hostName" /> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="row mb-1 align-items-center"> | ||||
|                     <Label Class="col-sm-3" For="template" HelpText="Select a site template" ResourceKey="Template">Template:</Label> | ||||
|                     <div class="col-sm-9"> | ||||
| @ -153,6 +159,7 @@ | ||||
|     private string _toggleConfirmPassword = string.Empty; | ||||
|     private string _confirmPassword = string.Empty; | ||||
|     private string _hostEmail = string.Empty; | ||||
|     private string _hostName = string.Empty; | ||||
|     private List<SiteTemplate> _templates; | ||||
|     private string _template = Constants.DefaultSiteTemplate; | ||||
|     private bool _register = true; | ||||
| @ -236,7 +243,7 @@ | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (connectionString != "" && !string.IsNullOrEmpty(_hostUsername) && !string.IsNullOrEmpty(_hostPassword) && _hostPassword == _confirmPassword && !string.IsNullOrEmpty(_hostEmail) && _hostEmail.Contains("@")) | ||||
|         if (connectionString != "" && !string.IsNullOrEmpty(_hostUsername) && !string.IsNullOrEmpty(_hostPassword) && _hostPassword == _confirmPassword && !string.IsNullOrEmpty(_hostEmail) && _hostEmail.Contains("@") && !string.IsNullOrEmpty(_hostName)) | ||||
|         { | ||||
|             var result = await UserService.ValidateUserAsync(_hostUsername, _hostEmail, _hostPassword); | ||||
|             if (result.Succeeded) | ||||
| @ -256,7 +263,7 @@ | ||||
|                         HostUsername = _hostUsername, | ||||
|                         HostPassword = _hostPassword, | ||||
|                         HostEmail = _hostEmail, | ||||
|                         HostName = _hostUsername, | ||||
|                         HostName = _hostName, | ||||
|                         TenantName = TenantNames.Master, | ||||
|                         IsNewTenant = true, | ||||
|                         SiteName = Constants.DefaultSite, | ||||
|  | ||||
| @ -186,4 +186,10 @@ | ||||
|   <data name="Message.Username.Invalid" xml:space="preserve"> | ||||
|     <value>The Username Provided Does Not Meet The System Requirement, It Can Only Contains Letters Or Digits.</value> | ||||
|   </data> | ||||
|   <data name="Name.Text" xml:space="preserve"> | ||||
|     <value>Full Name:</value> | ||||
|   </data> | ||||
|   <data name="Name.HelpText" xml:space="preserve"> | ||||
|     <value>Provide the full name of the host user</value> | ||||
|   </data> | ||||
| </root> | ||||
| @ -57,9 +57,9 @@ namespace Oqtane.Services | ||||
|             await PostAsync($"{ApiUrl}/restart"); | ||||
|         } | ||||
|  | ||||
|         public async Task RegisterAsync(string email) | ||||
|         public async Task RegisterAsync(string email, string name) | ||||
|         { | ||||
|             await PostJsonAsync($"{ApiUrl}/register?email={WebUtility.UrlEncode(email)}", true); | ||||
|             await PostJsonAsync($"{ApiUrl}/register?email={WebUtility.UrlEncode(email)}&name={WebUtility.UrlEncode(name)}", true); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -39,8 +39,9 @@ namespace Oqtane.Services | ||||
|         /// 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); | ||||
|         Task RegisterAsync(string email, string name); | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -60,9 +60,9 @@ namespace Oqtane.Controllers | ||||
|             { | ||||
|                 installation = _databaseManager.Install(config); | ||||
|  | ||||
|                 if (installation.Success && config.Register) | ||||
|                 if (installation.Success) | ||||
|                 { | ||||
|                     await RegisterContact(config.HostEmail); | ||||
|                     await RegisterContact(config.HostEmail, config.HostName); | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
| @ -257,7 +257,7 @@ namespace Oqtane.Controllers | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private async Task RegisterContact(string email) | ||||
|         private async Task RegisterContact(string email, string name) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
| @ -268,7 +268,7 @@ namespace Oqtane.Controllers | ||||
|                     { | ||||
|                         client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value); | ||||
|                         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)}")).ConfigureAwait(false); | ||||
|                         var response = await client.GetAsync(new Uri(url + $"/api/registry/contact/?id={_configManager.GetInstallationId()}&email={WebUtility.UrlEncode(email)}&name={WebUtility.UrlEncode(name)}")).ConfigureAwait(false); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @ -278,12 +278,12 @@ namespace Oqtane.Controllers | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // GET api/<controller>/register?email=x | ||||
|         // GET api/<controller>/register?email=x&name=y | ||||
|         [HttpPost("register")] | ||||
|         [Authorize(Roles = RoleNames.Host)] | ||||
|         public async Task Register(string email) | ||||
|         public async Task Register(string email, string name) | ||||
|         { | ||||
|             await RegisterContact(email); | ||||
|             await RegisterContact(email, name); | ||||
|         } | ||||
|  | ||||
|         public struct ClientAssembly | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 sbwalker
					sbwalker