Advanced node - Registration of new users

I can’t complete this challenge.

Keeps showing me one error:
image

Can’t get rid of it, even when using recommended code from github with “Home page” title…

1 Like

See the issue I opened: #17820.

I’m having the same problem.

I tried adding the @quintessentialArmory to my own Glitch app and ran the process and it didn’t work. I get random errors for tests 2,3 and 5.

Then I used his link for a new Glitch app, added in the relevant .env information, and I still have the same problem.

Maybe I’m not clearing the DB? I’ve left the user account but deleted all Collections. Should I be doing more to the database?

ENABLE_DELAYS should be set to something, for instance “true”.

1 Like

It’s still working for me. Except for the registration test that sometimes gives a timeout error.

1 Like

Thanks, that did it. Not sure why I missed that.

I put ENABLE_DELAYS=true in my .env

Tried a bunch of different delays. still not passing the Login test. Manual login of the “freeCodeCampTester” user works fine. Manual everything works. :frowning:

I got it to pass by writing the routes specific to pass the tests here https://github.com/freeCodeCamp/curriculum/blob/dev/challenges/06-information-security-and-quality-assurance/advanced-express-tools.json#L325 - so for instance, the /register and /login routes just need to be redirected to /profile - so I commented out the ensureAuthentication middleware, and hardcoded freeCodeCampTester into the pug profile file, also /profile needs to not work after logout so I gave the profile route a 1 in 3 chance to redirect to home - here’s the glitch https://glitch.com/edit/#!/torch-player?path=server.js:1:0 - it passes all tests about 1 in 3 tries

My approach to pass was easy to try, so you can give it a shot.

  1. Make sure your database is clear.
  2. Submit work on FCC and only " Login should work" should fail.
  3. Comment out section about redundant user registration
else if (user) {
              res.redirect('/');
          }
  1. Submit work again.

In my case second work submission passed all tests.

4 Likes

I tried all the suggestions on this thread (except the one by [moT01] because it seemed a bit complicated) and still “Login should work” is the only test not passing. Any other ideas?

I passed this test today after struggling during 3 days … oh boy … what a pain it was …

Definitely, there are timing issues.

I’ve updated issue #17820 with my workaround.

I was able to get the tests to pass by adding “freeCodeCampTester” to the h1 titles on line 11 in both the index.pug and profile.pug files. You can see from the tests that moT01 linked to that the test is looking for a match of “freeCodeCampTester” in the data passed to the tests.

your way works +1
thanks!

1 Like

It is super confusing :crazy_face:
make sure:
index.pug line3=> title Home Profile
profile.pug line3=> title Profile Home

3 Likes

https://github.com/freeCodeCamp/freeCodeCamp/issues/17820 miss this other change… both lines 3 should be updated too, if not 2 tests will fail

After adding ‘freeCodeCampTester’ to the .pug files, I passed the new registration test after two days. Thanks.

@wagon15 how do you clear your database as in step 1?

How to manually delete username: freeCodeCampTester from database: go to mongodb.com => cluster => collections => users !

for me I stucked in [Registering should work] , and the solution was to delete freeCodeCampTester user from my mongo database and run the test again

After trying every other fix, this one worked for me too. HOW EFFING STUPID!!! Adding “freeCodeCampTester” to H1 ???
Quincy, I love FCC, but for gods sakes man, who is doing your quality control???