Skip to content

500 while creating users #29218

Closed
Closed
@Infinoid

Description

@Infinoid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions