From 7d4dab025535786999172c9159ed8c0b4a743fae Mon Sep 17 00:00:00 2001
From: Tasnim1147 <87118828+Tasnim1147@users.noreply.github.com>
Date: Thu, 12 Sep 2024 14:05:57 +0000
Subject: [PATCH 1/5] New error msg
---
public/language/en-US/error.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/language/en-US/error.json b/public/language/en-US/error.json
index f12e15c94f..2ce9b28e4f 100644
--- a/public/language/en-US/error.json
+++ b/public/language/en-US/error.json
@@ -31,7 +31,7 @@
"invalid-path": "Invalid path",
"folder-exists": "Folder exists",
"invalid-pagination-value": "Invalid pagination value, must be at least %1 and at most %2",
- "username-taken": "Username taken",
+ "username-taken": "Username taken. How about user1234",
"email-taken": "Email address is already taken.",
"email-nochange": "The email entered is the same as the email already on file.",
"email-invited": "Email was already invited",
From 851a6b20c034952eb6e76338c1577dbe95aa2c95 Mon Sep 17 00:00:00 2001
From: Tasnim1147 <87118828+Tasnim1147@users.noreply.github.com>
Date: Thu, 12 Sep 2024 20:50:30 +0000
Subject: [PATCH 2/5] Format showError to suggest username
---
public/src/client/register.js | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/public/src/client/register.js b/public/src/client/register.js
index d8144d26d5..1c18ceb1e8 100644
--- a/public/src/client/register.js
+++ b/public/src/client/register.js
@@ -182,15 +182,26 @@ define('forum/register', [
}
}
+
function showError(input, element, msg) {
- translator.translate(msg, function (msg) {
+ translator.translate(msg, function (translatedMsg) {
input.attr('aria-invalid', 'true');
- element.html(msg);
+
+ // Used chatgpt to add the feature of randomly generated suggested username
+ if (msg === '[[error:username-taken]]') {
+ const originalUsername = input.val();
+ const suggestedUsername = originalUsername + Math.floor(Math.random() * 1000);
+
+ translatedMsg += `
Suggested username: ${suggestedUsername}`;
+ }
+
+ element.html(translatedMsg);
element.parent()
.removeClass('register-success')
.addClass('register-danger');
element.show();
});
+
validationError = true;
}
From fc4e165e415ff288af09ff273a41a89e4b2bf26a Mon Sep 17 00:00:00 2001
From: Tasnim1147 <87118828+Tasnim1147@users.noreply.github.com>
Date: Thu, 12 Sep 2024 20:51:15 +0000
Subject: [PATCH 3/5] Revert public/language/en-US/error.json
---
public/language/en-US/error.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/language/en-US/error.json b/public/language/en-US/error.json
index 2ce9b28e4f..ae9a6eb41d 100644
--- a/public/language/en-US/error.json
+++ b/public/language/en-US/error.json
@@ -31,7 +31,7 @@
"invalid-path": "Invalid path",
"folder-exists": "Folder exists",
"invalid-pagination-value": "Invalid pagination value, must be at least %1 and at most %2",
- "username-taken": "Username taken. How about user1234",
+ "username-taken": "Username taken.",
"email-taken": "Email address is already taken.",
"email-nochange": "The email entered is the same as the email already on file.",
"email-invited": "Email was already invited",
From 6fc3f252f95cc7d06cb531a30f58cd8dfdf5934b Mon Sep 17 00:00:00 2001
From: Tasnim1147 <87118828+Tasnim1147@users.noreply.github.com>
Date: Thu, 12 Sep 2024 20:55:08 +0000
Subject: [PATCH 4/5] Resolve lint issues
---
public/src/client/register.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/public/src/client/register.js b/public/src/client/register.js
index 1c18ceb1e8..a91e178cf2 100644
--- a/public/src/client/register.js
+++ b/public/src/client/register.js
@@ -186,15 +186,12 @@ define('forum/register', [
function showError(input, element, msg) {
translator.translate(msg, function (translatedMsg) {
input.attr('aria-invalid', 'true');
-
// Used chatgpt to add the feature of randomly generated suggested username
if (msg === '[[error:username-taken]]') {
const originalUsername = input.val();
const suggestedUsername = originalUsername + Math.floor(Math.random() * 1000);
-
translatedMsg += `
Suggested username: ${suggestedUsername}`;
}
-
element.html(translatedMsg);
element.parent()
.removeClass('register-success')
From 5ec8501db496a9556e95611cd28f88701792758d Mon Sep 17 00:00:00 2001
From: Tasnim1147 <87118828+Tasnim1147@users.noreply.github.com>
Date: Thu, 12 Sep 2024 20:57:20 +0000
Subject: [PATCH 5/5] Resolve lint 185-201
---
public/src/client/register.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/public/src/client/register.js b/public/src/client/register.js
index a91e178cf2..834790ed5e 100644
--- a/public/src/client/register.js
+++ b/public/src/client/register.js
@@ -182,7 +182,6 @@ define('forum/register', [
}
}
-
function showError(input, element, msg) {
translator.translate(msg, function (translatedMsg) {
input.attr('aria-invalid', 'true');
@@ -198,7 +197,6 @@ define('forum/register', [
.addClass('register-danger');
element.show();
});
-
validationError = true;
}