From 0321a8a69dacd0a0f8aa6624d9aa948649044d8a Mon Sep 17 00:00:00 2001 From: donarbl Date: Thu, 29 Jan 2026 14:29:06 +0000 Subject: [PATCH 1/2] changed the login actions --- front-end/views/profile.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front-end/views/profile.mjs b/front-end/views/profile.mjs index dd2b92a..31139a9 100644 --- a/front-end/views/profile.mjs +++ b/front-end/views/profile.mjs @@ -39,8 +39,8 @@ function profileView(username) { createLogin ); document - .querySelector("[data-action='login']") - ?.addEventListener("click", handleLogin); + .querySelector("[data-form='login']") + ?.addEventListener("submit", handleLogin); const profileData = state.profiles.find((p) => p.username === username); if (profileData) { From bc09dc929e9cda449b505d0961ffb0da08c9b576 Mon Sep 17 00:00:00 2001 From: donarbl Date: Thu, 29 Jan 2026 15:27:58 +0000 Subject: [PATCH 2/2] fixed 280 symbols in both places --- backend/data/blooms.py | 5 +++++ backend/endpoints.py | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/backend/data/blooms.py b/backend/data/blooms.py index 7e280cf..62b4238 100644 --- a/backend/data/blooms.py +++ b/backend/data/blooms.py @@ -14,8 +14,13 @@ class Bloom: content: str sent_timestamp: datetime.datetime +MAX_BLOOM_LENGTH = 280 # this is to ensure the extra safety def add_bloom(*, sender: User, content: str) -> Bloom: + + if len(content) > MAX_BLOOM_LENGTH: + raise ValueError(f"blooms content is too long(max {MAX_BLOOM_LENGTH})") + hashtags = [word[1:] for word in content.split(" ") if word.startswith("#")] now = datetime.datetime.now(tz=datetime.UTC) diff --git a/backend/endpoints.py b/backend/endpoints.py index 0e177a0..c237739 100644 --- a/backend/endpoints.py +++ b/backend/endpoints.py @@ -149,13 +149,22 @@ def do_follow(): } ) - +MAX_BLOOM_LENGTH = 280 @jwt_required() def send_bloom(): type_check_error = verify_request_fields({"content": str}) if type_check_error is not None: return type_check_error + content = request.json ["content"] + + if len(content) > MAX_BLOOM_LENGTH: + return make_response( + ({"success": False, + "message": f"blloms can't be longe than {MAX_BLOOM_LENGTH} symbols", + }, 400,) + ) + user = get_current_user() blooms.add_bloom(sender=user, content=request.json["content"])