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

500 while creating users #29218

Closed
Infinoid opened this issue Feb 17, 2024 · 3 comments · Fixed by #29226
Closed

500 while creating users #29218

Infinoid opened this issue Feb 17, 2024 · 3 comments · Fixed by #29226
Labels
Milestone

Comments

@Infinoid
Copy link
Contributor

Description

When an admin of a limited/private server goes to create a new user, the User visibility field of the "Create User Account" page has a bug. Specifically, after the form submission validation is rejected, the User visibility dropdown seems to be mapping the wrong values.

This looks very similar to #25951, but it happens in gitea 1.21.5, and only happens after a form submission error.

Gitea configuration:

[service]
DISABLE_REGISTRATION              = true
DEFAULT_USER_VISIBILITY           = limited
ALLOWED_USER_VISIBILITY_MODES     = limited,private

Steps to reproduce:

  1. Have a gitea instance configured as described above
  2. Log in as an admin user
  3. Attempt to create a new user through the /admin/users/new page, but fail the form validation
  4. Correct the form fields and submit again
  5. 500 internal server error

I compared the DOM trees before and after the validation failure, and the dropdown box selection no longer has the classes active and selected.

Before validation failure:

<div class="item active selected" data-tooltip-content="Visible only to authenticated users" data-value="1" id="_aria_auto_id_16" role="option" tabindex="-1" aria-label="Visible only to authenticated users">Limited</div>

After validation failure:

<div class="item" data-tooltip-content="Visible only to authenticated users" data-value="1" id="_aria_auto_id_16" role="option" tabindex="-1" aria-label="Visible only to authenticated users">Limited</div>

That might be the problem? I'm not completely sure, but it looks likely to me.

Gitea Version

1.21.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

image
image
image

Git Version

No response

Operating System

No response

How are you running Gitea?

official docker image, GOARCH=arm64

Database

PostgreSQL

silverwind pushed a commit that referenced this issue Feb 18, 2024
Don't throw error while creating user (Fixes #29218)
@lunny lunny added this to the 1.21.6 milestone Feb 18, 2024
zokkis added a commit to zokkis/gitea that referenced this issue Feb 18, 2024
Backport go-gitea#29226

Don't throw error while creating user (Fixes go-gitea#29218)
zokkis added a commit to zokkis/gitea that referenced this issue Feb 18, 2024
Backport go-gitea#29226

Don't throw error while creating user (Fixes go-gitea#29218)
lafriks pushed a commit that referenced this issue Feb 18, 2024
Backport #29226

Don't throw error while creating user (Fixes #29218)

---

The backport info from Giteabot
#29226 (comment)
needs to specify the version, because the default is v1.18
@Infinoid
Copy link
Contributor Author

I tried today's "nightly" docker build, and confirmed that this is fixed. Thanks!

Wish the UI had some unit tests to prove these things tho...

@silverwind
Copy link
Member

Can't really unit-test a HTML form, but a e2e test might be able to.

silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Don't throw error while creating user (Fixes go-gitea#29218)
6543 pushed a commit to 6543-forks/gitea that referenced this issue Feb 26, 2024
Don't throw error while creating user (Fixes go-gitea#29218)

(cherry picked from commit 6093f50)
Copy link

github-actions bot commented Mar 1, 2024

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants