Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't login after leaving admin team #3422

Closed
4 tasks done
excelkobayashi opened this issue Jun 30, 2023 · 6 comments · Fixed by #4090
Closed
4 tasks done

[Bug]: Can't login after leaving admin team #3422

excelkobayashi opened this issue Jun 30, 2023 · 6 comments · Fixed by #4090
Labels
area: auth bug Something isn't working

Comments

@excelkobayashi
Copy link

excelkobayashi commented Jun 30, 2023

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

If the original administrator leaves the admin team, that user can no longer log in if the instance is set to require user registration applications.

Steps to Reproduce

  1. Create instance
  2. Require user registration
  3. Create 2nd admin user
  4. Have original admin leave admin team
  5. Log out and back in as original admin

Technical Details

Root Cause

utils.rs - check_registration_application requires the user to be admin or have an approved application.
Since the user was created without an application, a "record not found" error is thrown, which prevents the login.

Error Log

2023-06-30T05:52:15.267429Z  WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_
builder: Record not found
   0: lemmy_api::local_user::login::perform
           with self=Login { username_or_email: Sensitive, password: Sensitive, totp_2fa_token: None }
             at crates/api/src/local_user/login.rs:16
   1: lemmy_server::root_span_builder::HTTP request
           with http.method=POST http.scheme="https" http.host=lemmy.redacted.com http.target=/api/v3/user/login otel.kin
d="server" request_id=94a4abf6-368b-43a0-843b-65139aff2c46 http.status_code=404 otel.status_code="OK"
             at src/root_span_builder.rs:16
LemmyError { message: None, inner: Record not found, context: SpanTrace [{ target: "lemmy_api::local_user::login", name:
 "perform", fields: "\u{1b}[3mself\u{1b}[0m\u{1b}[2m=\u{1b}[0mLogin { username_or_email: Sensitive, password: Sensitive,
 totp_2fa_token: None }", file: "crates/api/src/local_user/login.rs", line: 16 }, { target: "lemmy_server::root_span_bui
lder", name: "HTTP request", fields: "\u{1b}[3mhttp.method\u{1b}[0m\u{1b}[2m=\u{1b}[0mPOST \u{1b}[3mhttp.scheme\u{1b}[0m
\u{1b}[2m=\u{1b}[0m\"https\" \u{1b}[3mhttp.host\u{1b}[0m\u{1b}[2m=\u{1b}[0mlemmy.redacted.com \u{1b}[3mhttp.target\u{1b}[
0m\u{1b}[2m=\u{1b}[0m/api/v3/user/login \u{1b}[3motel.kind\u{1b}[0m\u{1b}[2m=\u{1b}[0m\"server\" \u{1b}[3mrequest_id\u{1
b}[0m\u{1b}[2m=\u{1b}[0m94a4abf6-368b-43a0-843b-65139aff2c46 \u{1b}[3mhttp.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m404 \u
{1b}[3motel.status_code\u{1b}[0m\u{1b}[2m=\u{1b}[0m\"OK\"", file: "src/root_span_builder.rs", line: 16 }] }

Version

0.18.0

Lemmy Instance URL

No response

@excelkobayashi excelkobayashi added the bug Something isn't working label Jun 30, 2023
@dropdevrahul
Copy link

dropdevrahul commented Jul 1, 2023

seems like it should be handled when an admin leaves an admin team ? if an admin leaves should they still be allowed to login as user? if yes we can mark it as with application true however if an admin should not be allowed to login as normal user after he leaves this seems to be correct behaviour?

@null-dev
Copy link

null-dev commented Jul 1, 2023

This also happens when an instance is set to "Open Registration", users register and then the instance is set to "Closed Registration".

Workaround:
Set accepted_application to TRUE for the affected users in the local_user table.

@rcmaehl rcmaehl mentioned this issue Jul 1, 2023
4 tasks
@MJB9000
Copy link

MJB9000 commented Jul 2, 2023

I still cant log-in, first 404 site ban then i stopped getting this error today, i cleared cache, used a new private tor window, reset my password, checked modlog, and nothing helped, my username is "MJB9000" , i think i was blocked as i have seen but i still haven't interacted or done anything in lemmy.world, i just created this account, something is not right, please look into it.

contact: hi@mahmoudjbaydoun.com

@CookieXD
Copy link

CookieXD commented Jul 2, 2023

Me2 johannisp.123@gmail.com cannot login without any error message. It just does not happen anything when pressing login.

@MJB9000
Copy link

MJB9000 commented Jul 8, 2023

I still cant log-in, first 404 site ban then i stopped getting this error today, i cleared cache, used a new private tor window, reset my password, checked modlog, and nothing helped, my username is "MJB9000" , i think i was blocked as i have seen but i still haven't interacted or done anything in lemmy.world, i just created this account, something is not right, please look into it.

contact: hi@mahmoudjbaydoun.com

Still cant log in, can someone please help?

@hannahswain
Copy link

I encountered this after removing my everyday user from the server admin team to increase server security. I'm not sure if this was happening before the 0.18.3 upgrade but showed up after the upgrade.

Confirmed by checking the API responses in the browser tools - you'll see "record not found" when trying to log in with this specific user.

Used the following workaround, seems to be working for me:

  1. Log in as a server admin
  2. Server settings > switch to "open registration".
  3. Save settings
  4. Log out of admin user
  5. Log in as preferred user
  6. Log out as preferred user
  7. Log in as admin
  8. Server settings > switch to "registration required"
  9. Log out admin
  10. Log in as regular user and enjoy

dessalines added a commit that referenced this issue Oct 24, 2023
#4090)

* Fix bug when leaving admin team, setting accepted application as true. Fixes #3422

* Addressing PR comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: auth bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants