mirror of
https://github.com/hykilpikonna/AquaDX.git
synced 2026-05-20 12:18:15 -05:00
[O] More checks
This commit is contained in:
parent
7b89016359
commit
9c4f146778
|
|
@ -34,7 +34,7 @@ class UserRegistrar(
|
|||
if (!email.isValidEmail()) 400 > "Invalid email"
|
||||
|
||||
// Check if user with the same email exists
|
||||
if (async { userRepo.existsByEmail(email) }) 400 > "User already exists"
|
||||
if (async { userRepo.existsByEmail(email) }) 400 > "User with email `$email` already exists"
|
||||
|
||||
// Check if username is valid
|
||||
if (username.length < 2) 400 > "Username must be at least 2 letters"
|
||||
|
|
@ -47,6 +47,9 @@ class UserRegistrar(
|
|||
"You can set a display name later."
|
||||
}
|
||||
|
||||
// Check if user with the same username exists
|
||||
if (async { userRepo.existsByUsername(username) }) 400 > "User with username `$username` already exists"
|
||||
|
||||
// Validate password
|
||||
if (password.length < 8) 400 > "Password must be at least 8 characters"
|
||||
|
||||
|
|
|
|||
|
|
@ -45,4 +45,5 @@ class AquaNetUser(
|
|||
@Repository("AquaNetUserRepository")
|
||||
interface AquaNetUserRepo : JpaRepository<AquaNetUser, Int> {
|
||||
fun existsByEmail(email: String): Boolean
|
||||
fun existsByUsername(username: String): Boolean
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user