Copilot commented on code in PR #6402:
URL: https://github.com/apache/texera/pull/6402#discussion_r3640211841


##########
amber/src/main/scala/org/apache/texera/web/resource/auth/AuthResource.scala:
##########
@@ -102,22 +102,34 @@ class AuthResource {
   @POST
   @Path("/register")
   def register(request: UserRegistrationRequest): TokenIssueResponse = {
-    val username = request.username
-    if (username == null) throw new NotAcceptableException("Username cannot be 
null.")
-    if (username.trim.isEmpty) throw new NotAcceptableException("Username 
cannot be empty.")
-    userDao.fetchByName(username).size() match {
-      case 0 =>
+    val username = Option(request.username).getOrElse("").trim
+    val useremail = Option(request.email).getOrElse("").trim
+    val userpassword = request.password
+    if (username.trim.isEmpty)
+      throw new NotAcceptableException("Username cannot be empty")
+    if (useremail.trim.isEmpty)
+      throw new NotAcceptableException("Email cannot be empty")
+    if (userpassword == null || userpassword.isEmpty)
+      throw new NotAcceptableException("Password cannot be empty")

Review Comment:
   The updated registration validation error strings drop the trailing period 
that this file (and other auth resources) uses, which can make UI/server 
messages inconsistent and may break any tests that assert exact messages. 
Consider restoring punctuation and simplifying the redundant `trim` calls since 
`username`/`useremail` are already trimmed.
   
   This issue also appears in the following locations of the same file:
   - line 110
   - line 115



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to