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

Unable to register on recipya-app.musicavis.ca #436

Closed
salty-catpuccino opened this issue Sep 15, 2024 · 3 comments · Fixed by #440
Closed

Unable to register on recipya-app.musicavis.ca #436

salty-catpuccino opened this issue Sep 15, 2024 · 3 comments · Fixed by #440
Assignees
Labels
bug Something isn't working
Milestone

Comments

@salty-catpuccino
Copy link

Describe the bug
When trying to register I get the following error:

Form Error
User might be registered or password invalid

I can guarantee that these credentials do not exist anywhere else on this application.
I have tried multiple emails and multiple passwords with different configurations.
I also turned off all Firefox Add-Ons and got the same issue.
I have not tried a different browser but can if need be.

To Reproduce
Steps to reproduce the behavior:

  1. Go to recipya-app.musicavis.ca
  2. Click on 'Sign up'
  3. Enter new sign up credentials
  4. See error

Desktop (please complete the following information):

  • OS: Linux Mint
  • Browser Firefox
  • Version 130

Additional context
Console log reads as follows:

Error: Promised response from onMessage listener went out of scope [background.js:505:27](moz-extension://81df8ddd-62e9-40e3-9f96-8367fb7d0ed5/js/background/background.js)
XHRPOST
https://recipya-app.musicavis.ca/auth/register
[HTTP/2 422  86ms]

Response Status Error Code 422 from /auth/register [htmx.org@2.0.0:1:25892](https://unpkg.com/htmx.org@2.0.0)

Let me know if there are any stack traces you would like to see in particular

@salty-catpuccino salty-catpuccino added the bug Something isn't working label Sep 15, 2024
@reaper47 reaper47 self-assigned this Sep 16, 2024
@reaper47 reaper47 added this to the v1.3.0 milestone Sep 16, 2024
@reaper47 reaper47 added the question Further information is requested label Sep 16, 2024
@reaper47
Copy link
Owner

I am unable to reproduce this error because I managed to create a new account successfully on recipya-app.musicavis.ca.

The error you receive comes from this if block in the source code:

// internal/server/handlers_auth.go
func (s *Server) registerPostHandler() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		email := r.FormValue("email")
		password := r.FormValue("password")

		if !regex.Email.MatchString(email) || password != r.FormValue("password-confirm") {
			w.Header().Set("HX-Trigger", models.NewErrorFormToast("User might be registered or password invalid.").Render())
			w.WriteHeader(http.StatusUnprocessableEntity)
			return
		}
        ...
}

The order of error checks is as follows once you submit a registration:

  1. Validate the fields from the form: Form error: User might be registered or password invalid.
  2. Hash the password: Form error: Error encoding your password.
  3. Register user in database: Database error: User might be registered or password invalid.
  4. Create auth token: Auth error: User might be registered or password invalid.

Something you could do is the following:

  1. Access the registration page: https://recipya-app.musicavis.ca/auth/register
  2. Open the Web Developer Tools (F12) and go to the Network tab
  3. Click the settings gear in the upper right and ensure Persist logs is checked
  4. Type in your email, password and password once more. Please use a dumb password for step 8 below.
  5. Submit
  6. In the network tab, click the 422 POST recipya-app.musicavis.ca /registry entry
  7. Click the Request tab under the panel that appears on the right
  8. Please send the Form data that you see to me at macpoule@gmail.com.
  9. I will have the information needed to see what's going on

@salty-catpuccino
Copy link
Author

Thank you for this great breakdown!
I went ahead and sent you that email with my dummy credentials.

@reaper47 reaper47 removed the question Further information is requested label Sep 16, 2024
@reaper47 reaper47 linked a pull request Sep 16, 2024 that will close this issue
@reaper47
Copy link
Owner

The problem is now fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants