From 40f611fd096e2b31b3ee1b85c30174fe0437f316 Mon Sep 17 00:00:00 2001 From: Young-Ho Kim Date: Sun, 23 Aug 2020 11:57:02 -0400 Subject: [PATCH] add lowercase rule for username in researcher's participan account creation dialog. --- .../create-user-account-dialog.component.html | 3 +++ .../create-user-account-dialog.component.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.html b/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.html index 9e4b8c1..7ca52ec 100644 --- a/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.html +++ b/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.html @@ -14,6 +14,9 @@
This field is required.
+
+ Username must contain only lower case letters and numbers. +
Username must be between 3 and 50 letters.
diff --git a/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.ts b/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.ts index ed84eff..4dda8e5 100644 --- a/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.ts +++ b/client/app/experiment-participants/create-user-account-dialog/create-user-account-dialog.component.ts @@ -54,7 +54,7 @@ export class CreateUserAccountDialogComponent implements OnInit, OnDestroy { password = new FormControl("", [Validators.required, Validators.minLength(4)]) - username = new FormControl("", [Validators.required, Validators.minLength(3), Validators.maxLength(50), noDuplicateValidator(this.data.participants.map(p => p.username))]) + username = new FormControl("", [Validators.required, Validators.minLength(3), Validators.pattern('^[a-z0-9]+$'), Validators.maxLength(50), noDuplicateValidator(this.data.participants.map(p => p.username))]) email = new FormControl("changeme@email.com", [Validators.required, Validators.email])