mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-06-01 05:32:27 +00:00
Allow RegistrationTokens to have a username pre-selected (#524)
* 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:
parent
bfe81c3461
commit
c7195df74f
9 changed files with 66 additions and 12 deletions
ProjectLighthouse.Servers.API/Controllers
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue