Registration fails when SHOW_REGISTRATION_BUTTON = false #2453

Closed
opened 2025-11-02 04:36:48 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @lpoujol on GitHub (Oct 25, 2018).

Description

Hi,
I've been trying gitea with some coworkers. For our tests, I've decided to go with registration enabled but with the registration button hidden. So our config looked like :

[service]
DISABLE_REGISTRATION = false
SHOW_REGISTRATION_BUTTON = false
REGISTER_EMAIL_CONFIRM = true
ENABLE_CAPTCHA = true

As expected, the registration button is hidden, but the registration page is visible. Then after filling the form. Validating it leads to a 403 page with empty content. No user is created.

Expected behavior : Registration works, and a new account is created.

Also, when SHOW_REGISTRATION_BUTTON is set to true, registration do work as expected.

Screenshots

gitea_403

Originally created by @lpoujol on GitHub (Oct 25, 2018). - Gitea version (or commit ref): 1.5.2 - Git version: 2.11.0 - Operating system: Debian Stretch - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: https://gist.github.com/lpoujol/728e3b299c53ed7bef579a3ab0e5cdd6 (when retried with loglevel as debug) ## Description Hi, I've been trying gitea with some coworkers. For our tests, I've decided to go with registration enabled but with the registration button hidden. So our config looked like : ``` [service] DISABLE_REGISTRATION = false SHOW_REGISTRATION_BUTTON = false REGISTER_EMAIL_CONFIRM = true ENABLE_CAPTCHA = true ``` As expected, the registration button is hidden, but the registration page is visible. Then after filling the form. Validating it leads to a 403 page with empty content. No user is created. Expected behavior : Registration works, and a new account is created. Also, when SHOW_REGISTRATION_BUTTON is set to true, registration do work as expected. ## Screenshots ![gitea_403](https://user-images.githubusercontent.com/110898/47509270-c5ef4180-d843-11e8-9085-0c48822c34ab.png)
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 04:36:48 -06:00
Author
Owner

@lunny commented on GitHub (Oct 25, 2018):

It seems no error on log files.

@lunny commented on GitHub (Oct 25, 2018): It seems no error on log files.
Author
Owner

@r-52 commented on GitHub (Nov 30, 2018):

You can reproduce this behavior with the mentioned settings. You can reach the regular SignUp page because there's nothing that checks the settings entry SHOW_REGISTRATION_BUTTON.
c8a9384a70/routers/user/auth.go (L899)

If you hit the send button/trigger the form-post, the action checks if SHOW_REGISTRATION_BUTTON is true or returns the 403.
c8a9384a70/routers/user/auth.go (L926-L929)

I believe there are two ways to change this:

  • already check SHOW_REGISTRATION_BUTTON in the get action to return a 403 or redirect to login.
  • keep the current behavior, but remove the check in the post action to keep a semi-hidden signup page, that is not reachable from the navbar

what do you think? Is it worth a pr?

@r-52 commented on GitHub (Nov 30, 2018): You can reproduce this behavior with the mentioned settings. You can reach the regular SignUp page because there's nothing that checks the settings entry `SHOW_REGISTRATION_BUTTON`. https://github.com/go-gitea/gitea/blob/c8a9384a70219fbc85473404f2ac2747387d73ea/routers/user/auth.go#L899 If you hit the send button/trigger the form-post, the action checks if `SHOW_REGISTRATION_BUTTON` is true or returns the `403`. https://github.com/go-gitea/gitea/blob/c8a9384a70219fbc85473404f2ac2747387d73ea/routers/user/auth.go#L926-L929 I believe there are two ways to change this: - already check `SHOW_REGISTRATION_BUTTON` in the get action to return a 403 or redirect to login. - keep the current behavior, but remove the check in the post action to keep a semi-hidden signup page, that is not reachable from the navbar what do you think? Is it worth a pr?
Author
Owner

@lunny commented on GitHub (Nov 30, 2018):

@romankl PR is welcome.

@lunny commented on GitHub (Nov 30, 2018): @romankl PR is welcome.
Author
Owner

@stale[bot] commented on GitHub (May 7, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (May 7, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2453