added basic create account

- add link in to creat in users.html
- AccountController
  - add getCreateAccount
  - add postCreateAccount
- add create.html
- add AccountForm to Account Request in Mapping.kt
- add AccountForm
- add addAccount to AccountRegistryService
- add accountRegistryCreate to WebClientCalls.kt
- add UsernameDuplicateException
- add AccountRegistryException
- add HlaejaException
This commit is contained in:
2025-01-27 11:39:04 +01:00
parent 34349653db
commit 8e65de0350
11 changed files with 240 additions and 6 deletions

View File

@@ -1,10 +1,18 @@
package ltd.hlaeja.util
import org.springframework.security.core.Authentication as SpringAuthentication
import ltd.hlaeja.form.AccountForm
import ltd.hlaeja.library.accountRegistry.Account
import ltd.hlaeja.library.accountRegistry.Authentication
import org.springframework.security.core.Authentication as SpringAuthentication
fun SpringAuthentication.toAuthenticationRequest(): Authentication.Request = Authentication.Request(
principal as String,
credentials as String,
)
fun AccountForm.toAccountRequest(): Account.Request = Account.Request(
username = username,
password = password,
enabled = enabled,
roles = listOf("ROLE_${role.uppercase()}"),
)