Allow RegistrationTokens to have a username pre-selected ()

* Add prefilled username to registration token

* call toString on query to work with EF

* Fix typo in RegisterForm.cshtml

* Only show username notice if the user's username hasn't been chosen already

* Add confirmation message to DeleteUserCommand
This commit is contained in:
Josh 2022-10-31 20:48:09 -05:00 committed by GitHub
parent bfe81c3461
commit c7195df74f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 66 additions and 12 deletions
ProjectLighthouse.Servers.API/Controllers

View file

@ -68,7 +68,8 @@ public class UserEndpoints : ApiEndpointController
}
[HttpPost("user/inviteToken")]
public async Task<IActionResult> CreateUserInviteToken()
[HttpPost("user/inviteToken/{username}")]
public async Task<IActionResult> CreateUserInviteToken([FromRoute] string? username)
{
if (!Configuration.ServerConfiguration.Instance.Authentication.PrivateRegistration &&
!Configuration.ServerConfiguration.Instance.Authentication.RegistrationEnabled)
@ -86,6 +87,7 @@ public class UserEndpoints : ApiEndpointController
{
Created = DateTime.Now,
Token = CryptoHelper.GenerateAuthToken(),
Username = username,
};
this.database.RegistrationTokens.Add(token);