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


##########
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.isEmpty)
+      throw new NotAcceptableException("Username cannot be empty")
+    if (useremail.isEmpty)
+      throw new NotAcceptableException("Email cannot be empty")
+    if (userpassword == null || userpassword.isEmpty)
+      throw new NotAcceptableException("Password cannot be empty")

Review Comment:
   Backend registration currently only checks that `email` is non-empty; 
without a format check, API clients (or scripts) can persist malformed emails 
even though the frontend validates. Add a basic syntactic validation 
server-side so the `/auth/register` contract is enforced consistently.



##########
frontend/src/app/common/service/user/user.service.ts:
##########
@@ -134,6 +134,24 @@ export class UserService {
     return { result: true, message: "Username frontend validation success." };
   }
 
+  /**
+   * check the given parameter is a syntactically valid email address for 
registration
+   * @param email
+   */

Review Comment:
   Doc comment grammar: start sentences with "Checks …" (and punctuate) to keep 
JSDoc style consistent and readable.



-- 
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