lemmy-ui icon indicating copy to clipboard operation
lemmy-ui copied to clipboard

Sign up stalls when username is too long

Open mkldn opened this issue 2 years ago • 1 comments
trafficstars

Found a bug? Please fill out the sections below. 👍

For backend issues, use lemmy

Issue Summary

When you try to sign up and pick a username that is too long (I think 20 is the default max?) the sign up-button just starts spinning and then nothing more happens.

If you shorten your username it goes through without a glitch.

Feels like there should be an error thrown for usernames that are too long. I nosed around in the code a bit but I've never touched Rust before so I figure I'll leave it to someone who's more used to it. I did find a validator for it though in validators.rs:

pub fn is_valid_actor_name(name: &str, actor_name_max_length: usize) -> LemmyResult<()> { let check = name.chars().count() <= actor_name_max_length && VALID_ACTOR_NAME_REGEX.is_match(name) && !has_newline(name); if !check { Err(LemmyError::from_message("invalid_name")) } else { Ok(()) } }

Not sure why it's not triggering thoug, I'll let you guys sort that out.

Steps to Reproduce

  1. Fill in a long username, add a password and a comment for the spam filter, click submit (or whatever the button is called in English)
  2. Button keeps spinning
  3. No error message is shown

Technical details

sign_up validator

mkldn avatar Jun 10 '23 14:06 mkldn

I've also seen:

  1. Signup hangs when you use an already existing username.

  2. If the server admin turns off signup, the top right of the site still has a "Sign Up" link and the sigup page still presents a form to join - but hangs.

RocketDerp avatar Jun 12 '23 00:06 RocketDerp

I was able to reproduce some bugs in the latest version 0.17.4

  1. When the password doesn't match, it keeps spinning without providing a response. (I received a response from the API indicating "passwords_dont_match")
  2. If the captcha is incorrect, it also keeps spinning without any response. (I received a response from the API indicating "captcha_incorrect")
  3. When a username is already in use, it returns a "502 Bad Gateway" error. The Lemmy log shows the following error message:
    thread 'actix-rt|system:0|arbiter:5' panicked at 'couldn't create local user: DatabaseError(UniqueViolation, "duplicate key value violates unique constraint \"local_user_person_id_key\"")', crates/db_schema/src/impls/local_user.rs:157:8
    
  4. Similarly, if an email is already in use, it also returns a "502 Bad Gateway" error. The Lemmy log displays the following error message:
    thread 'actix-rt|system:0|arbiter:4' panicked at 'couldn't create local user: DatabaseError(UniqueViolation, "duplicate key value violates unique constraint \"local_user_email_key\"")', crates/db_schema/src/impls/local_user.rs:157:8
    

xximj avatar Jun 16 '23 17:06 xximj

There is a recent code pull request for login form crashes that seems similar to signup form problems: https://github.com/LemmyNet/lemmy-ui/pull/1305

RocketDerp avatar Jun 16 '23 18:06 RocketDerp

@mkldn I think this issue is resolved as I now see an error message.

Can we close this?

RayBB avatar Jun 23 '23 23:06 RayBB

Yeah, sounds about right then!

mkldn avatar Jun 25 '23 06:06 mkldn

@mkldn you can close this issue. I don't have powers to.

RayBB avatar Jun 25 '23 21:06 RayBB

Error message is shown, closing

mkldn avatar Jun 26 '23 05:06 mkldn